druid-ts 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +27 -0
- data/features/async.feature +6 -0
- data/features/div.feature +1 -0
- data/features/element.feature +4 -0
- data/features/hidden_field.feature +0 -2
- data/features/html/async.html +13 -0
- data/features/html/multi_elements.html +4 -0
- data/features/html/static_elements.html +10 -3
- data/features/link.feature +1 -0
- data/features/multi_elements.feature +135 -25
- data/features/select_list.feature +8 -0
- data/features/span.feature +2 -0
- data/features/step_definations/async_steps.rb +17 -0
- data/features/step_definations/element_steps.rb +6 -0
- data/features/step_definations/multi_elements_steps.rb +96 -0
- data/features/step_definations/select_list_steps.rb +12 -0
- data/features/step_definations/table_steps.rb +20 -3
- data/features/support/ajax_test_environment.rb +1 -1
- data/features/support/page.rb +7 -2
- data/features/table.feature +35 -0
- data/features/text_area.feature +0 -2
- data/features/text_field.feature +1 -2
- data/lib/druid.rb +31 -3
- data/lib/druid/accessors.rb +184 -146
- data/lib/druid/assist.rb +10 -2
- data/lib/druid/element_locators.rb +186 -102
- data/lib/druid/elements/div.rb +1 -1
- data/lib/druid/elements/element.rb +131 -96
- data/lib/druid/elements/hidden_field.rb +1 -5
- data/lib/druid/elements/link.rb +1 -1
- data/lib/druid/elements/select_list.rb +8 -0
- data/lib/druid/elements/span.rb +1 -1
- data/lib/druid/elements/table.rb +14 -3
- data/lib/druid/elements/table_row.rb +17 -2
- data/lib/druid/elements/text_area.rb +0 -8
- data/lib/druid/elements/text_field.rb +1 -1
- data/lib/druid/javascript/yui.rb +19 -0
- data/lib/druid/javascript_framework_facade.rb +3 -1
- data/lib/druid/nested_elements.rb +1 -1
- data/lib/druid/page_factory.rb +25 -0
- data/lib/druid/page_populator.rb +1 -0
- data/lib/druid/version.rb +1 -1
- data/spec/druid/accessors_spec.rb +189 -1
- data/spec/druid/druid_spec.rb +6 -0
- data/spec/druid/element_locators_spec.rb +276 -0
- data/spec/druid/elements/div_spec.rb +1 -1
- data/spec/druid/elements/element_spec.rb +11 -0
- data/spec/druid/elements/hidden_field_spec.rb +0 -5
- data/spec/druid/elements/link_spec.rb +1 -1
- data/spec/druid/elements/span_spec.rb +1 -1
- data/spec/druid/elements/text_area_spec.rb +0 -5
- data/spec/druid/elements/text_field_spec.rb +1 -1
- data/spec/druid/page_factory_spec.rb +20 -0
- data/spec/druid/page_populator_spec.rb +8 -4
- metadata +2 -1
data/lib/druid/assist.rb
CHANGED
@@ -23,7 +23,8 @@ module Druid
|
|
23
23
|
# retrieve an array of hidden field elements
|
24
24
|
#
|
25
25
|
def text_fields_for(identifier)
|
26
|
-
find_elements("text_fields(identifier)", Elements::TextField, identifier)
|
26
|
+
elements = find_elements("text_fields(identifier)", Elements::TextField, identifier)
|
27
|
+
elements.select {|e| e.element.tag_name == "input"}
|
27
28
|
end
|
28
29
|
|
29
30
|
def text_field_value_for identifier
|
@@ -233,7 +234,7 @@ module Druid
|
|
233
234
|
end
|
234
235
|
|
235
236
|
def text_area_value_set identifier, value
|
236
|
-
process_call("textarea(identifier).
|
237
|
+
process_call("textarea(identifier).set(value)", Elements::TextArea, identifier, value)
|
237
238
|
end
|
238
239
|
|
239
240
|
def text_area_value_for identifier
|
@@ -373,6 +374,13 @@ module Druid
|
|
373
374
|
find_element("file_field(identifier)", Elements::FileField, identifier)
|
374
375
|
end
|
375
376
|
|
377
|
+
#
|
378
|
+
# retrieve an array of file field elements
|
379
|
+
#
|
380
|
+
def file_fields_for identifier
|
381
|
+
find_elements("file_fields(identifier)", Elements::FileField, identifier)
|
382
|
+
end
|
383
|
+
|
376
384
|
#
|
377
385
|
# method to return the text for a label
|
378
386
|
#
|
@@ -5,7 +5,8 @@ module Druid
|
|
5
5
|
# Finds a button
|
6
6
|
#
|
7
7
|
# @param [Hash] identifier how we find a button. You can use a multiple paramaters
|
8
|
-
# by combining of any of the following except xpath.
|
8
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
9
|
+
# which will find the first button. The valid keys are:
|
9
10
|
# * :class
|
10
11
|
# * :id
|
11
12
|
# * :index
|
@@ -17,7 +18,7 @@ module Druid
|
|
17
18
|
# * :alt
|
18
19
|
# * :css
|
19
20
|
#
|
20
|
-
def button_element
|
21
|
+
def button_element(identifier={:index => 0})
|
21
22
|
button_for identifier.clone
|
22
23
|
end
|
23
24
|
|
@@ -25,7 +26,8 @@ module Druid
|
|
25
26
|
# Finds all buttons that match the provided identifier
|
26
27
|
#
|
27
28
|
# @param [Hash] identifier how we find all buttons. You can use a multiple paramaters
|
28
|
-
# by combining of any of the following except xpath.
|
29
|
+
# by combining of any of the following except xpath. It defaults to an empty
|
30
|
+
# hash which will find all button elements. The valid keys are:
|
29
31
|
# * :class
|
30
32
|
# * :id
|
31
33
|
# * :index
|
@@ -37,7 +39,7 @@ module Druid
|
|
37
39
|
# * :alt
|
38
40
|
# * :css
|
39
41
|
#
|
40
|
-
def button_elements
|
42
|
+
def button_elements(identifier={})
|
41
43
|
buttons_for identifier.clone
|
42
44
|
end
|
43
45
|
|
@@ -45,7 +47,8 @@ module Druid
|
|
45
47
|
# Finds a text field
|
46
48
|
#
|
47
49
|
# @param [Hash] identifier how we find a text field. You can use a multiple parameters
|
48
|
-
# by combining of any of the following except xpath.
|
50
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
51
|
+
# which will find the first text field. The valid keys are:
|
49
52
|
# * :class
|
50
53
|
# * :css
|
51
54
|
# * :id
|
@@ -56,7 +59,7 @@ module Druid
|
|
56
59
|
# * :xpath
|
57
60
|
# * :title
|
58
61
|
#
|
59
|
-
def text_field_element
|
62
|
+
def text_field_element(identifier={:index => 0})
|
60
63
|
text_field_for identifier.clone
|
61
64
|
end
|
62
65
|
|
@@ -64,7 +67,8 @@ module Druid
|
|
64
67
|
# Finds all text fields that match the provided identifier
|
65
68
|
#
|
66
69
|
# @param [Hash] identifier how we find all text fields. You can use a multiple parameters
|
67
|
-
#
|
70
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
71
|
+
# which will find all text field elements. The valid keys are:
|
68
72
|
#
|
69
73
|
# * :class
|
70
74
|
# * :css
|
@@ -76,7 +80,7 @@ module Druid
|
|
76
80
|
# * :xpath
|
77
81
|
# * :title
|
78
82
|
#
|
79
|
-
def text_field_elements(identifier)
|
83
|
+
def text_field_elements(identifier={})
|
80
84
|
text_fields_for identifier.clone
|
81
85
|
end
|
82
86
|
|
@@ -84,7 +88,8 @@ module Druid
|
|
84
88
|
# Finds a hidden field
|
85
89
|
#
|
86
90
|
# @param [Hash] identifier how we find a hidden field. You can use a multiple parameters
|
87
|
-
# by combining of any of the following except xpath.
|
91
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
92
|
+
# which will find the first hidden field. The valid keys are:
|
88
93
|
# * :class
|
89
94
|
# * :css
|
90
95
|
# * :id
|
@@ -95,7 +100,7 @@ module Druid
|
|
95
100
|
# * :xpath
|
96
101
|
# * :value
|
97
102
|
#
|
98
|
-
def hidden_field_element
|
103
|
+
def hidden_field_element(identifier={:index => 0})
|
99
104
|
hidden_field_for identifier.clone
|
100
105
|
end
|
101
106
|
|
@@ -103,7 +108,8 @@ module Druid
|
|
103
108
|
# Finds all hidden fields that match the identifier
|
104
109
|
#
|
105
110
|
# @param [Hash] identifier how we find all hidden fields. You can use a multiple parameters
|
106
|
-
#
|
111
|
+
# by combining of any of the following except xpath. It defaults to an empty Hash
|
112
|
+
# which will return all hidden fields. The valid keys are:
|
107
113
|
#
|
108
114
|
# * :class
|
109
115
|
# * :css
|
@@ -115,7 +121,7 @@ module Druid
|
|
115
121
|
# * :xpath
|
116
122
|
# * :value
|
117
123
|
#
|
118
|
-
def hidden_field_elements
|
124
|
+
def hidden_field_elements(identifier={})
|
119
125
|
hidden_fields_for identifier.clone
|
120
126
|
end
|
121
127
|
|
@@ -123,7 +129,8 @@ module Druid
|
|
123
129
|
# Finds a text area
|
124
130
|
#
|
125
131
|
# @param [Hash] identifier how we find a text area. You can use a multiple parameters
|
126
|
-
# by combining of any of the following except xpath.
|
132
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
133
|
+
# which will find the first text area. The valid keys are:
|
127
134
|
# * :class
|
128
135
|
# * :css
|
129
136
|
# * :id
|
@@ -132,7 +139,7 @@ module Druid
|
|
132
139
|
# * :tag_name
|
133
140
|
# * :xpath
|
134
141
|
#
|
135
|
-
def text_area_element
|
142
|
+
def text_area_element(identifier={:index => 0})
|
136
143
|
text_area_for identifier.clone
|
137
144
|
end
|
138
145
|
|
@@ -140,7 +147,8 @@ module Druid
|
|
140
147
|
# Finds all text areas for the provided identifier
|
141
148
|
#
|
142
149
|
# @param [Hash] identifier how we find all text areas. You can use a multiple parameters
|
143
|
-
#
|
150
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
151
|
+
# which will return all text areas. The valid keys are:
|
144
152
|
# * :class
|
145
153
|
# * :css
|
146
154
|
# * :id
|
@@ -149,7 +157,7 @@ module Druid
|
|
149
157
|
# * :tag_name
|
150
158
|
# * :xpath
|
151
159
|
#
|
152
|
-
def text_area_elements
|
160
|
+
def text_area_elements(identifier={})
|
153
161
|
text_areas_for identifier.clone
|
154
162
|
end
|
155
163
|
|
@@ -157,7 +165,8 @@ module Druid
|
|
157
165
|
# Finds a select list
|
158
166
|
#
|
159
167
|
# @param [Hash] identifier how we find a select list. You can use a multiple parameters
|
160
|
-
# by combining of any of the following except xpath.
|
168
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
169
|
+
# Which will find the first select list The valid keys are:
|
161
170
|
# * :class
|
162
171
|
# * :id
|
163
172
|
# * :index
|
@@ -166,7 +175,7 @@ module Druid
|
|
166
175
|
# * :value
|
167
176
|
# * :text
|
168
177
|
#
|
169
|
-
def select_list_element
|
178
|
+
def select_list_element(identifier={:index => 0})
|
170
179
|
select_list_for identifier.clone
|
171
180
|
end
|
172
181
|
|
@@ -174,7 +183,8 @@ module Druid
|
|
174
183
|
# Finds all select lists for the provided identifier
|
175
184
|
#
|
176
185
|
# @param [Hash] identifier how we find all select lists. You can use a multiple paramaters
|
177
|
-
#
|
186
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
187
|
+
# which will return all select lists. The valid keys are:
|
178
188
|
# * :class
|
179
189
|
# * :id
|
180
190
|
# * :index
|
@@ -183,7 +193,7 @@ module Druid
|
|
183
193
|
# * :value
|
184
194
|
# * :text
|
185
195
|
#
|
186
|
-
def select_list_elements
|
196
|
+
def select_list_elements(identifier={})
|
187
197
|
select_lists_for identifier.clone
|
188
198
|
end
|
189
199
|
|
@@ -191,7 +201,8 @@ module Druid
|
|
191
201
|
# Finds a link
|
192
202
|
#
|
193
203
|
# @param [Hash] identifier how we find a link. You can use a multiple parameters
|
194
|
-
# by combining of any of the following except xpath.
|
204
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
205
|
+
# which will find the first link. The valid keys are:
|
195
206
|
# * :class
|
196
207
|
# * :href
|
197
208
|
# * :id
|
@@ -203,7 +214,7 @@ module Druid
|
|
203
214
|
# * :text
|
204
215
|
# * :css
|
205
216
|
#
|
206
|
-
def link_element
|
217
|
+
def link_element(identifier={:index => 0})
|
207
218
|
link_for identifier.clone
|
208
219
|
end
|
209
220
|
|
@@ -211,7 +222,8 @@ module Druid
|
|
211
222
|
# Finds all links for the provided identifier
|
212
223
|
#
|
213
224
|
# @param [Hash] identifier how we find all links. You can use a multiple parameters
|
214
|
-
#
|
225
|
+
# by combining of any of the following except xpath. It defaults to empty hash
|
226
|
+
# which will return all links. The valid keys are:
|
215
227
|
# * :class
|
216
228
|
# * :href
|
217
229
|
# * :id
|
@@ -223,7 +235,7 @@ module Druid
|
|
223
235
|
# * :text
|
224
236
|
# * :css
|
225
237
|
#
|
226
|
-
def link_elements
|
238
|
+
def link_elements(identifier={})
|
227
239
|
links_for identifier.clone
|
228
240
|
end
|
229
241
|
|
@@ -231,7 +243,8 @@ module Druid
|
|
231
243
|
# Finds a check box
|
232
244
|
#
|
233
245
|
# @param [Hash] identifier how we find a check box. You can use a multiple parameters
|
234
|
-
# by combining of any of the following except xpath.
|
246
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
247
|
+
# which will find the first checkbox. The valid keys are:
|
235
248
|
# * :class
|
236
249
|
# * :id
|
237
250
|
# * :index
|
@@ -239,7 +252,7 @@ module Druid
|
|
239
252
|
# * :xpath
|
240
253
|
# * :value
|
241
254
|
#
|
242
|
-
def checkbox_element
|
255
|
+
def checkbox_element(identifier={:index => 0})
|
243
256
|
checkbox_for identifier.clone
|
244
257
|
end
|
245
258
|
|
@@ -247,7 +260,8 @@ module Druid
|
|
247
260
|
# Finds all checkbox elements for the provided identifier
|
248
261
|
#
|
249
262
|
# @param [Hash] identifier how we find a checkbox. You can use a multiple parameters
|
250
|
-
#
|
263
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
264
|
+
# which will return all checkboxes. The valid keys are:
|
251
265
|
# * :class
|
252
266
|
# * :id
|
253
267
|
# * :index
|
@@ -255,7 +269,7 @@ module Druid
|
|
255
269
|
# * :xpath
|
256
270
|
# * :value
|
257
271
|
#
|
258
|
-
def checkbox_elements
|
272
|
+
def checkbox_elements(identifier={})
|
259
273
|
checkboxes_for identifier.clone
|
260
274
|
end
|
261
275
|
|
@@ -263,14 +277,15 @@ module Druid
|
|
263
277
|
# Finds a radio button
|
264
278
|
#
|
265
279
|
# @param [Hash] identifier how we find a radio button. You can use a multiple parameters
|
266
|
-
# by combining of any of the following except xpath.
|
280
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
281
|
+
# which will find the first radio button. The valid keys are:
|
267
282
|
# * :class
|
268
283
|
# * :id
|
269
284
|
# * :index
|
270
285
|
# * :name
|
271
286
|
# * :xpath
|
272
287
|
#
|
273
|
-
def radio_button_element
|
288
|
+
def radio_button_element(identifier={:index => 0})
|
274
289
|
radio_button_for identifier.clone
|
275
290
|
end
|
276
291
|
|
@@ -278,14 +293,15 @@ module Druid
|
|
278
293
|
# Finds all radio button elements that match the provided identifier
|
279
294
|
#
|
280
295
|
# @param [Hash] identifier how we find a radio button. You can use a multiple parameters
|
281
|
-
#
|
296
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
297
|
+
# which will return all radio buttons. The valid keys are:
|
282
298
|
# * :class
|
283
299
|
# * :id
|
284
300
|
# * :index
|
285
301
|
# * :name
|
286
302
|
# * :xpath
|
287
303
|
#
|
288
|
-
def radio_button_elements
|
304
|
+
def radio_button_elements(identifier={})
|
289
305
|
radio_buttons_for identifier.clone
|
290
306
|
end
|
291
307
|
|
@@ -293,7 +309,8 @@ module Druid
|
|
293
309
|
# Finds a div
|
294
310
|
#
|
295
311
|
# @param [Hash] identifier how we find a div. You can use a multiple parameters
|
296
|
-
# by combining of any of the following except xpath.
|
312
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
313
|
+
# which will find the first div. The valid keys are:
|
297
314
|
# * :class
|
298
315
|
# * :id
|
299
316
|
# * :index
|
@@ -301,7 +318,7 @@ module Druid
|
|
301
318
|
# * :xpath
|
302
319
|
# * :text
|
303
320
|
#
|
304
|
-
def div_element
|
321
|
+
def div_element(identifier={:index => 0})
|
305
322
|
div_for identifier.clone
|
306
323
|
end
|
307
324
|
|
@@ -309,7 +326,8 @@ module Druid
|
|
309
326
|
# Finds all divs that match the provided identifier
|
310
327
|
#
|
311
328
|
# @param [Hash] identifier how we find a div. You can use a multiple parameters
|
312
|
-
#
|
329
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
330
|
+
# which will return all divs. The valid keys are:
|
313
331
|
# * :class
|
314
332
|
# * :id
|
315
333
|
# * :index
|
@@ -317,7 +335,7 @@ module Druid
|
|
317
335
|
# * :xpath
|
318
336
|
# * :text
|
319
337
|
#
|
320
|
-
def div_elements
|
338
|
+
def div_elements(identifier={})
|
321
339
|
divs_for identifier
|
322
340
|
end
|
323
341
|
|
@@ -325,14 +343,15 @@ module Druid
|
|
325
343
|
# Finds a span
|
326
344
|
#
|
327
345
|
# @param [Hash] identifier how we find a span. You can use a multiple parameters
|
328
|
-
# by combining of any of the following except xpath.
|
346
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
347
|
+
# which will find the first span. The valid keys are:
|
329
348
|
# * :class
|
330
349
|
# * :id
|
331
350
|
# * :index
|
332
351
|
# * :name
|
333
352
|
# * :xpath
|
334
353
|
#
|
335
|
-
def span_element
|
354
|
+
def span_element(identifier={:index => 0})
|
336
355
|
span_for identifier.clone
|
337
356
|
end
|
338
357
|
|
@@ -340,14 +359,15 @@ module Druid
|
|
340
359
|
# Finds all span elements that match the provided identifier
|
341
360
|
#
|
342
361
|
# @param [Hash] identifier how we find a span. You can use multiple parameters
|
343
|
-
#
|
362
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
363
|
+
# which will return all spans. The valid keys are:
|
344
364
|
# * :class
|
345
365
|
# * :id
|
346
366
|
# * :index
|
347
367
|
# * :name
|
348
368
|
# * :xpath
|
349
369
|
#
|
350
|
-
def span_elements
|
370
|
+
def span_elements(identifier={})
|
351
371
|
spans_for identifier.clone
|
352
372
|
end
|
353
373
|
|
@@ -355,14 +375,15 @@ module Druid
|
|
355
375
|
# Finds a table
|
356
376
|
#
|
357
377
|
# @param [Hash] identifier how we find a table. You can use a multiple parameters
|
358
|
-
#
|
378
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
379
|
+
# which will find the first table. The valid keys are:
|
359
380
|
# * :class
|
360
381
|
# * :id
|
361
382
|
# * :index
|
362
383
|
# * :name
|
363
384
|
# * :xpath
|
364
385
|
#
|
365
|
-
def table_element
|
386
|
+
def table_element(identifier={:index => 0})
|
366
387
|
table_for identifier.clone
|
367
388
|
end
|
368
389
|
|
@@ -370,14 +391,15 @@ module Druid
|
|
370
391
|
# Finds all tables with match the provided identifier
|
371
392
|
#
|
372
393
|
# @param [Hash] identifier how we find a table. You can use a multiple parameters
|
373
|
-
#
|
394
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
395
|
+
# which will return all tables. The valid keys are:
|
374
396
|
# * :class
|
375
397
|
# * :id
|
376
398
|
# * :index
|
377
399
|
# * :name
|
378
400
|
# * :xpath
|
379
401
|
#
|
380
|
-
def table_elements
|
402
|
+
def table_elements(identifier={})
|
381
403
|
tables_for identifier.clone
|
382
404
|
end
|
383
405
|
|
@@ -385,7 +407,8 @@ module Druid
|
|
385
407
|
# Finds a table cell
|
386
408
|
#
|
387
409
|
# @param [Hash] identifier how we find a table cell. You can use a multiple parameters
|
388
|
-
#
|
410
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
411
|
+
# which will find the first cell. The valid keys are:
|
389
412
|
# * :class
|
390
413
|
# * :id
|
391
414
|
# * :index
|
@@ -393,7 +416,7 @@ module Druid
|
|
393
416
|
# * :xpath
|
394
417
|
# * :text
|
395
418
|
#
|
396
|
-
def cell_element
|
419
|
+
def cell_element(identifier={:index => 0})
|
397
420
|
cell_for identifier.clone
|
398
421
|
end
|
399
422
|
|
@@ -401,7 +424,8 @@ module Druid
|
|
401
424
|
# Finds all table cell elements that match the provided identifier
|
402
425
|
#
|
403
426
|
# @param [Hash] identifier how we find a cell. You can use a multiple parameters
|
404
|
-
#
|
427
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
428
|
+
# which will return all cells. The valid keys are:
|
405
429
|
# * :class
|
406
430
|
# * :id
|
407
431
|
# * :index
|
@@ -409,7 +433,7 @@ module Druid
|
|
409
433
|
# * :xpath
|
410
434
|
# * :text
|
411
435
|
#
|
412
|
-
def cell_elements
|
436
|
+
def cell_elements(identifier={})
|
413
437
|
cells_for identifier.clone
|
414
438
|
end
|
415
439
|
|
@@ -417,7 +441,8 @@ module Druid
|
|
417
441
|
# Finds an image
|
418
442
|
#
|
419
443
|
# @param [Hash] identifier how we find an image. You can use a multiple parameters
|
420
|
-
#
|
444
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
445
|
+
# which will find the first image. The valid keys are:
|
421
446
|
# * :class
|
422
447
|
# * :id
|
423
448
|
# * :index
|
@@ -426,7 +451,7 @@ module Druid
|
|
426
451
|
# * :alt
|
427
452
|
# * :src
|
428
453
|
#
|
429
|
-
def image_element
|
454
|
+
def image_element(identifier={:index => 0})
|
430
455
|
image_for identifier.clone
|
431
456
|
end
|
432
457
|
|
@@ -434,7 +459,8 @@ module Druid
|
|
434
459
|
# Finds all images that match the provided identifier
|
435
460
|
#
|
436
461
|
# @param [Hash] identifier how we find an image. You can use a multiple parameters
|
437
|
-
#
|
462
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
463
|
+
# which will return all images. The valid keys are:
|
438
464
|
# * :class
|
439
465
|
# * :id
|
440
466
|
# * :index
|
@@ -443,7 +469,7 @@ module Druid
|
|
443
469
|
# * :alt
|
444
470
|
# * :src
|
445
471
|
#
|
446
|
-
def image_elements
|
472
|
+
def image_elements(identifier={})
|
447
473
|
images_for identifier.clone
|
448
474
|
end
|
449
475
|
|
@@ -451,14 +477,15 @@ module Druid
|
|
451
477
|
# Finds a form
|
452
478
|
#
|
453
479
|
# @param [Hash] identifier how we find a form. You can use a multiple parameters
|
454
|
-
#
|
480
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
481
|
+
# which will find the first form. The valid keys are:
|
455
482
|
# * :class
|
456
483
|
# * :id
|
457
484
|
# * :index
|
458
485
|
# * :xpath
|
459
486
|
# * :action
|
460
487
|
#
|
461
|
-
def form_element
|
488
|
+
def form_element(identifier={:index => 0})
|
462
489
|
form_for identifier.clone
|
463
490
|
end
|
464
491
|
|
@@ -466,14 +493,15 @@ module Druid
|
|
466
493
|
# Finds all forms that match the provided identifier
|
467
494
|
#
|
468
495
|
# @param [Hash] identifier how we find a form. You can use a multiple parameters
|
469
|
-
#
|
496
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
497
|
+
# which will return all forms. The valid keys are:
|
470
498
|
# * :class
|
471
499
|
# * :id
|
472
500
|
# * :index
|
473
501
|
# * :xpath
|
474
502
|
# * :action
|
475
503
|
#
|
476
|
-
def form_elements
|
504
|
+
def form_elements(identifier={})
|
477
505
|
forms_for identifier.clone
|
478
506
|
end
|
479
507
|
|
@@ -481,14 +509,15 @@ module Druid
|
|
481
509
|
# Finds a list item
|
482
510
|
#
|
483
511
|
# @param [Hash] identifier how we find a list item. You can use a multiple parameters
|
484
|
-
#
|
512
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
513
|
+
# which will find the first list item. The valid keys are:
|
485
514
|
# * :class
|
486
515
|
# * :id
|
487
516
|
# * :index
|
488
517
|
# * :xpath
|
489
518
|
# * :name
|
490
519
|
#
|
491
|
-
def list_item_element
|
520
|
+
def list_item_element(identifier={:index => 0})
|
492
521
|
list_item_for identifier.clone
|
493
522
|
end
|
494
523
|
|
@@ -496,14 +525,15 @@ module Druid
|
|
496
525
|
# Finds all list items that match the identifier
|
497
526
|
#
|
498
527
|
# @param [Hash] identifier how we find a list item. You can use a multiple parameters
|
499
|
-
#
|
528
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
529
|
+
# which will return all list items. The valid keys are:
|
500
530
|
# * :class
|
501
531
|
# * :id
|
502
532
|
# * :index
|
503
533
|
# * :xpath
|
504
534
|
# * :name
|
505
535
|
#
|
506
|
-
def list_item_elements
|
536
|
+
def list_item_elements(identifier={})
|
507
537
|
list_items_for identifier.clone
|
508
538
|
end
|
509
539
|
|
@@ -511,14 +541,15 @@ module Druid
|
|
511
541
|
# Finds an ordered list
|
512
542
|
#
|
513
543
|
# @param [Hash] identifier how we find an ordered list. You can use a multiple parameters
|
514
|
-
#
|
544
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
545
|
+
# which will find the first ordered list. The valid keys are:
|
515
546
|
# * :class
|
516
547
|
# * :id
|
517
548
|
# * :index
|
518
549
|
# * :xpath
|
519
550
|
# * :name
|
520
551
|
#
|
521
|
-
def ordered_list_element
|
552
|
+
def ordered_list_element(identifier={:index => 0})
|
522
553
|
ordered_list_for identifier.clone
|
523
554
|
end
|
524
555
|
|
@@ -526,14 +557,15 @@ module Druid
|
|
526
557
|
# Finds all ordered lists that match the provided identifier
|
527
558
|
#
|
528
559
|
# @param [Hash] identifier how we find an ordered list. You can use a multiple parameters
|
529
|
-
#
|
560
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
561
|
+
# which will return all ordered lists. The valid keys are:
|
530
562
|
# * :class
|
531
563
|
# * :id
|
532
564
|
# * :index
|
533
565
|
# * :xpath
|
534
566
|
# * :name
|
535
567
|
#
|
536
|
-
def ordered_list_elements
|
568
|
+
def ordered_list_elements(identifier={})
|
537
569
|
ordered_lists_for identifier.clone
|
538
570
|
end
|
539
571
|
|
@@ -541,14 +573,15 @@ module Druid
|
|
541
573
|
# Finds an unordered list
|
542
574
|
#
|
543
575
|
# @param [Hash] identifier how we find an unordered list. You can use a multiple parameters
|
544
|
-
#
|
576
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
577
|
+
# which will find the first unordered list. The valid keys are:
|
545
578
|
# * :class
|
546
579
|
# * :id
|
547
580
|
# * :index
|
548
581
|
# * :xpath
|
549
582
|
# * :name
|
550
583
|
#
|
551
|
-
def unordered_list_element
|
584
|
+
def unordered_list_element(identifier={:index => 0})
|
552
585
|
unordered_list_for identifier.clone
|
553
586
|
end
|
554
587
|
|
@@ -556,14 +589,15 @@ module Druid
|
|
556
589
|
# Finds all unordered lists that match the provided identifier
|
557
590
|
#
|
558
591
|
# @param [Hash] identifier how we find an unordered list. You can use a multiple parameters
|
559
|
-
#
|
592
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
593
|
+
# which will return all unordered lists. The valid keys are:
|
560
594
|
# * :class
|
561
595
|
# * :id
|
562
596
|
# * :index
|
563
597
|
# * :xpath
|
564
598
|
# * :name
|
565
599
|
#
|
566
|
-
def unordered_list_elements
|
600
|
+
def unordered_list_elements(identifier={})
|
567
601
|
unordered_lists_for identifier.clone
|
568
602
|
end
|
569
603
|
|
@@ -571,14 +605,15 @@ module Druid
|
|
571
605
|
# Finds a h1
|
572
606
|
#
|
573
607
|
# @param [Hash] identifier how we find a h1. You can use a multiple parameters
|
574
|
-
#
|
608
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
609
|
+
# which will find the first h1. The valid keys are:
|
575
610
|
# * :class
|
576
611
|
# * :id
|
577
612
|
# * :index
|
578
613
|
# * :xpath
|
579
614
|
# * :name
|
580
615
|
#
|
581
|
-
def h1_element
|
616
|
+
def h1_element(identifier={:index => 0})
|
582
617
|
h1_for identifier.clone
|
583
618
|
end
|
584
619
|
|
@@ -587,14 +622,15 @@ module Druid
|
|
587
622
|
#
|
588
623
|
#
|
589
624
|
# @param [Hash] identifier how we find a h1. You can use a multiple parameters
|
590
|
-
#
|
625
|
+
# by combining of any of the following except xpath. It defaults to empty hash
|
626
|
+
# which will return all h1s. The valid keys are:
|
591
627
|
# * :class
|
592
628
|
# * :id
|
593
629
|
# * :index
|
594
630
|
# * :xpath
|
595
631
|
# * :name
|
596
632
|
#
|
597
|
-
def h1_elements
|
633
|
+
def h1_elements(identifier={})
|
598
634
|
h1s_for identifier.clone
|
599
635
|
end
|
600
636
|
|
@@ -602,14 +638,15 @@ module Druid
|
|
602
638
|
# Finds a h2
|
603
639
|
#
|
604
640
|
# @param [Hash] identifier how we find a h2. You can use a multiple parameters
|
605
|
-
#
|
641
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
642
|
+
# which will find the first h2. The valid keys are:
|
606
643
|
# * :class
|
607
644
|
# * :id
|
608
645
|
# * :index
|
609
646
|
# * :xpath
|
610
647
|
# * :name
|
611
648
|
#
|
612
|
-
def h2_element
|
649
|
+
def h2_element(identifier={:index => 0})
|
613
650
|
h2_for identifier.clone
|
614
651
|
end
|
615
652
|
|
@@ -618,14 +655,15 @@ module Druid
|
|
618
655
|
#
|
619
656
|
#
|
620
657
|
# @param [Hash] identifier how we find a h2. You can use a multiple parameters
|
621
|
-
#
|
658
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
659
|
+
# which will return all h2s. The valid keys are:
|
622
660
|
# * :class
|
623
661
|
# * :id
|
624
662
|
# * :index
|
625
663
|
# * :xpath
|
626
664
|
# * :name
|
627
665
|
#
|
628
|
-
def h2_elements
|
666
|
+
def h2_elements(identifier={})
|
629
667
|
h2s_for identifier.clone
|
630
668
|
end
|
631
669
|
|
@@ -633,14 +671,15 @@ module Druid
|
|
633
671
|
# Finds a h3
|
634
672
|
#
|
635
673
|
# @param [Hash] identifier how we find a h3. You can use a multiple parameters
|
636
|
-
#
|
674
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
675
|
+
# which will find the first h3. The valid keys are:
|
637
676
|
# * :class
|
638
677
|
# * :id
|
639
678
|
# * :index
|
640
679
|
# * :xpath
|
641
680
|
# * :name
|
642
681
|
#
|
643
|
-
def h3_element
|
682
|
+
def h3_element(identifier={:index => 0})
|
644
683
|
h3_for identifier.clone
|
645
684
|
end
|
646
685
|
|
@@ -649,14 +688,15 @@ module Druid
|
|
649
688
|
#
|
650
689
|
#
|
651
690
|
# @param [Hash] identifier how we find a h3. You can use a multiple parameters
|
652
|
-
#
|
691
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
692
|
+
# which will return all h3s. The valid keys are:
|
653
693
|
# * :class
|
654
694
|
# * :id
|
655
695
|
# * :index
|
656
696
|
# * :xpath
|
657
697
|
# * :name
|
658
698
|
#
|
659
|
-
def h3_elements
|
699
|
+
def h3_elements(identifier={})
|
660
700
|
h3s_for identifier.clone
|
661
701
|
end
|
662
702
|
|
@@ -664,14 +704,15 @@ module Druid
|
|
664
704
|
# Finds a h4
|
665
705
|
#
|
666
706
|
# @param [Hash] identifier how we find a h4. You can use a multiple parameters
|
667
|
-
#
|
707
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
708
|
+
# which will find the first h4. The valid keys are:
|
668
709
|
# * :class
|
669
710
|
# * :id
|
670
711
|
# * :index
|
671
712
|
# * :xpath
|
672
713
|
# * :name
|
673
714
|
#
|
674
|
-
def h4_element
|
715
|
+
def h4_element(identifier={:index => 0})
|
675
716
|
h4_for identifier.clone
|
676
717
|
end
|
677
718
|
|
@@ -680,14 +721,15 @@ module Druid
|
|
680
721
|
#
|
681
722
|
#
|
682
723
|
# @param [Hash] identifier how we find a h4. You can use a multiple parameters
|
683
|
-
#
|
724
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
725
|
+
# which will return all h4s. The valid keys are:
|
684
726
|
# * :class
|
685
727
|
# * :id
|
686
728
|
# * :index
|
687
729
|
# * :xpath
|
688
730
|
# * :name
|
689
731
|
#
|
690
|
-
def h4_elements
|
732
|
+
def h4_elements(identifier={})
|
691
733
|
h4s_for identifier.clone
|
692
734
|
end
|
693
735
|
|
@@ -695,14 +737,15 @@ module Druid
|
|
695
737
|
# Finds a h5
|
696
738
|
#
|
697
739
|
# @param [Hash] identifier how we find a h5. You can use a multiple parameters
|
698
|
-
#
|
740
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
741
|
+
# which will find the first h5. The valid keys are:
|
699
742
|
# * :class
|
700
743
|
# * :id
|
701
744
|
# * :index
|
702
745
|
# * :xpath
|
703
746
|
# * :name
|
704
747
|
#
|
705
|
-
def h5_element
|
748
|
+
def h5_element(identifier={:index => 0})
|
706
749
|
h5_for identifier.clone
|
707
750
|
end
|
708
751
|
|
@@ -711,14 +754,15 @@ module Druid
|
|
711
754
|
#
|
712
755
|
#
|
713
756
|
# @param [Hash] identifier how we find a h5. You can use a multiple parameters
|
714
|
-
#
|
757
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
758
|
+
# which will return all h5s. The valid keys are:
|
715
759
|
# * :class
|
716
760
|
# * :id
|
717
761
|
# * :index
|
718
762
|
# * :xpath
|
719
763
|
# * :name
|
720
764
|
#
|
721
|
-
def h5_elements
|
765
|
+
def h5_elements(identifier={})
|
722
766
|
h5s_for identifier.clone
|
723
767
|
end
|
724
768
|
|
@@ -726,14 +770,15 @@ module Druid
|
|
726
770
|
# Finds a h6
|
727
771
|
#
|
728
772
|
# @param [Hash] identifier how we find a h6. You can use a multiple parameters
|
729
|
-
#
|
773
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
774
|
+
# which will find the first h6. The valid keys are:
|
730
775
|
# * :class
|
731
776
|
# * :id
|
732
777
|
# * :index
|
733
778
|
# * :xpath
|
734
779
|
# * :name
|
735
780
|
#
|
736
|
-
def h6_element
|
781
|
+
def h6_element(identifier={:index => 0})
|
737
782
|
h6_for identifier.clone
|
738
783
|
end
|
739
784
|
|
@@ -742,14 +787,15 @@ module Druid
|
|
742
787
|
#
|
743
788
|
#
|
744
789
|
# @param [Hash] identifier how we find a h6. You can use a multiple parameters
|
745
|
-
#
|
790
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
791
|
+
# which will return all h6s. The valid keys are:
|
746
792
|
# * :class
|
747
793
|
# * :id
|
748
794
|
# * :index
|
749
795
|
# * :xpath
|
750
796
|
# * :name
|
751
797
|
#
|
752
|
-
def h6_elements
|
798
|
+
def h6_elements(identifier={})
|
753
799
|
h6s_for identifier.clone
|
754
800
|
end
|
755
801
|
|
@@ -757,14 +803,15 @@ module Druid
|
|
757
803
|
# Finds a paragraph
|
758
804
|
#
|
759
805
|
# @param [Hash] identifier how we find a paragraph. You can use a multiple parameters
|
760
|
-
#
|
806
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
807
|
+
# which will find the first paragraph. The valid keys are:
|
761
808
|
# * :class
|
762
809
|
# * :id
|
763
810
|
# * :index
|
764
811
|
# * :xpath
|
765
812
|
# * :name
|
766
813
|
#
|
767
|
-
def paragraph_element
|
814
|
+
def paragraph_element(identifier={:index => 0})
|
768
815
|
paragraph_for identifier.clone
|
769
816
|
end
|
770
817
|
|
@@ -772,14 +819,15 @@ module Druid
|
|
772
819
|
# Finds all paragraph elements that match the provided identifier
|
773
820
|
#
|
774
821
|
# @param [Hash] identifier how we find a paragraph. You can use a multiple parameters
|
775
|
-
#
|
822
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
823
|
+
# which will return all paragraphs. The valid keys are:
|
776
824
|
# * :class
|
777
825
|
# * :id
|
778
826
|
# * :index
|
779
827
|
# * :xpath
|
780
828
|
# * :name
|
781
829
|
#
|
782
|
-
def paragraph_elements
|
830
|
+
def paragraph_elements(identifier={})
|
783
831
|
paragraphs_for identifier.clone
|
784
832
|
end
|
785
833
|
|
@@ -787,7 +835,8 @@ module Druid
|
|
787
835
|
# Finds a file field
|
788
836
|
#
|
789
837
|
# @param [Hash] identifier how we find a file field. You can use a multiple parameters
|
790
|
-
#
|
838
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
839
|
+
# which will find the first file field. The valid keys are:
|
791
840
|
# * :class
|
792
841
|
# * :id
|
793
842
|
# * :index
|
@@ -795,15 +844,33 @@ module Druid
|
|
795
844
|
# * :name
|
796
845
|
# * :title
|
797
846
|
#
|
798
|
-
def file_field_element
|
847
|
+
def file_field_element(identifier={:index => 0})
|
799
848
|
file_field_for identifier.clone
|
800
849
|
end
|
801
850
|
|
851
|
+
#
|
852
|
+
# Finds all file fields that match the provided identifier
|
853
|
+
#
|
854
|
+
# @param [Hash] identifier how we find a file field. You can use a multiple parameters
|
855
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
856
|
+
# which will return all file fields. The valid keys are:
|
857
|
+
# * :class
|
858
|
+
# * :id
|
859
|
+
# * :index
|
860
|
+
# * :xpath
|
861
|
+
# * :name
|
862
|
+
# * :title
|
863
|
+
#
|
864
|
+
def file_field_elements(identifier={})
|
865
|
+
file_fields_for identifier.clone
|
866
|
+
end
|
867
|
+
|
802
868
|
#
|
803
869
|
# Finds a label
|
804
870
|
#
|
805
871
|
# @param [Hash] identifier how we find a label. You can use a multiple paramaters
|
806
|
-
#
|
872
|
+
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
873
|
+
# which will find the first label. The valid keys are:
|
807
874
|
# * :class
|
808
875
|
# * :id
|
809
876
|
# * :index
|
@@ -811,7 +878,7 @@ module Druid
|
|
811
878
|
# * :text
|
812
879
|
# * :xpath
|
813
880
|
#
|
814
|
-
def label_element(identifier)
|
881
|
+
def label_element(identifier={:index => 0})
|
815
882
|
label_for identifier.clone
|
816
883
|
end
|
817
884
|
|
@@ -819,7 +886,8 @@ module Druid
|
|
819
886
|
# Finds all labels that match the provided identifier
|
820
887
|
#
|
821
888
|
# @param [Hash] identifier how we find a label. You can use a multiple paramaters
|
822
|
-
#
|
889
|
+
# by combining of any of the following except xpath. It defaults to empty Hash
|
890
|
+
# which will return all lables. The valid keys are:
|
823
891
|
# * :class
|
824
892
|
# * :id
|
825
893
|
# * :index
|
@@ -827,8 +895,24 @@ module Druid
|
|
827
895
|
# * :text
|
828
896
|
# * :xpath
|
829
897
|
#
|
830
|
-
def label_elements(identifier)
|
898
|
+
def label_elements(identifier={})
|
831
899
|
labels_for identifier.clone
|
832
900
|
end
|
901
|
+
|
902
|
+
#
|
903
|
+
# Finds an element
|
904
|
+
#
|
905
|
+
# @param [Symbol] the name of the tag for the element
|
906
|
+
# @param [Hash] identifier how we find an element. You can use a multiple parameters
|
907
|
+
# by combining of any of the following except xpath. The valid keys are:
|
908
|
+
# * :class
|
909
|
+
# * :id
|
910
|
+
# * :index
|
911
|
+
# * :name
|
912
|
+
# * :xpath
|
913
|
+
#
|
914
|
+
def element(tag, identifier={:index => 0})
|
915
|
+
element_for(tag, identifier.clone)
|
916
|
+
end
|
833
917
|
end
|
834
918
|
end
|