page-object 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +39 -0
- data/Gemfile +1 -0
- data/Rakefile +2 -2
- data/cucumber.yml +4 -4
- data/features/element.feature +5 -0
- data/features/{sample-app/public → html}/04-Death_Becomes_Fur.mp4 +0 -0
- data/features/{sample-app/public → html}/04-Death_Becomes_Fur.oga +0 -0
- data/features/{sample-app/public → html}/movie.mp4 +0 -0
- data/features/{sample-app/public → html}/movie.ogg +0 -0
- data/features/html/static_elements.html +7 -7
- data/features/sample-app/sample_app.rb +1 -1
- data/features/step_definitions/element_steps.rb +7 -0
- data/features/step_definitions/image_steps.rb +1 -1
- data/features/step_definitions/javascript_steps.rb +8 -2
- data/features/support/persistent_browser.rb +56 -3
- data/features/support/targets/firefox14_osx.rb +6 -0
- data/features/support/targets/firefox14_windows7.rb +6 -0
- data/features/support/url_helper.rb +3 -1
- data/lib/page-object/accessors.rb +131 -1003
- data/lib/page-object/element_locators.rb +9 -1008
- data/lib/page-object/locator_generator.rb +77 -0
- data/lib/page-object/nested_elements.rb +7 -230
- data/lib/page-object/page_factory.rb +10 -6
- data/lib/page-object/platforms/selenium_webdriver/element.rb +7 -0
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +2 -2
- data/lib/page-object/platforms/watir_webdriver/element.rb +7 -0
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +2 -2
- data/lib/page-object/version.rb +1 -1
- data/spec/page-object/elements/selenium_element_spec.rb +5 -0
- data/spec/page-object/elements/watir_element_spec.rb +6 -0
- data/spec/page-object/page_factory_spec.rb +9 -0
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +29 -0
- data/spec/page-object/platforms/watir_webdriver_spec.rb +0 -24
- data/spec/page-object/selenium_accessors_spec.rb +14 -0
- data/spec/page-object/watir_accessors_spec.rb +16 -17
- metadata +19 -12
@@ -1,1020 +1,21 @@
|
|
1
|
+
require 'page-object/locator_generator'
|
2
|
+
|
1
3
|
module PageObject
|
2
4
|
module ElementLocators
|
3
|
-
|
4
|
-
#
|
5
|
-
# Finds a button
|
6
|
-
#
|
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. It defaults to {:index => 0}
|
9
|
-
# which will find the first button. The valid keys are:
|
10
|
-
# * :class => Watir and Selenium
|
11
|
-
# * :css => Watir and Selenium
|
12
|
-
# * :id => Watir and Selenium
|
13
|
-
# * :index => Watir and Selenium
|
14
|
-
# * :name => Watir and Selenium
|
15
|
-
# * :text => Watir only
|
16
|
-
# * :value => Watir and Selenium
|
17
|
-
# * :xpath => Watir and Selenium
|
18
|
-
# * :src => Watir and Selenium (image button only)
|
19
|
-
# * :alt => Watir and Selenium (image button only)
|
20
|
-
#
|
21
|
-
def button_element(identifier={:index => 0})
|
22
|
-
platform.button_for(identifier.clone)
|
23
|
-
end
|
24
|
-
|
25
|
-
#
|
26
|
-
# Finds all buttons that match the provided identifier
|
27
|
-
#
|
28
|
-
# @param [Hash] identifier how we find a button. You can use a multiple paramaters
|
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:
|
31
|
-
# * :class => Watir and Selenium
|
32
|
-
# * :css => Watir and Selenium
|
33
|
-
# * :id => Watir and Selenium
|
34
|
-
# * :index => Watir and Selenium
|
35
|
-
# * :name => Watir and Selenium
|
36
|
-
# * :text => Watir only
|
37
|
-
# * :value => Watir and Selenium
|
38
|
-
# * :xpath => Watir and Selenium
|
39
|
-
# * :src => Watir and Selenium (image button only)
|
40
|
-
# * :alt => Watir and Selenium (image button only)
|
41
|
-
#
|
42
|
-
def button_elements(identifier={})
|
43
|
-
platform.buttons_for(identifier.clone)
|
44
|
-
end
|
45
|
-
|
46
|
-
#
|
47
|
-
# Finds a text field
|
48
|
-
#
|
49
|
-
# @param [Hash] identifier how we find a text field. You can use a multiple paramaters
|
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:
|
52
|
-
# * :class => Watir and Selenium
|
53
|
-
# * :css => Watir and Selenium
|
54
|
-
# * :id => Watir and Selenium
|
55
|
-
# * :index => Watir and Selenium
|
56
|
-
# * :name => Watir and Selenium
|
57
|
-
# * :tag_name => Watir and Selenium
|
58
|
-
# * :text => Watir only
|
59
|
-
# * :title => Watir and Selenium
|
60
|
-
# * :value => Watir only
|
61
|
-
# * :xpath => Watir and Selenium
|
62
|
-
#
|
63
|
-
def text_field_element(identifier={:index => 0})
|
64
|
-
platform.text_field_for(identifier.clone)
|
65
|
-
end
|
66
|
-
|
67
|
-
#
|
68
|
-
# Finds all text fields that match the provided identifier
|
69
|
-
#
|
70
|
-
# @param [Hash] identifier how we find a text field. You can use a multiple paramaters
|
71
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
72
|
-
# which will find all text field elements. The valid keys are:
|
73
|
-
# * :class => Watir and Selenium
|
74
|
-
# * :css => Watir and Selenium
|
75
|
-
# * :id => Watir and Selenium
|
76
|
-
# * :index => Watir and Selenium
|
77
|
-
# * :name => Watir and Selenium
|
78
|
-
# * :tag_name => Watir and Selenium
|
79
|
-
# * :text => Watir only
|
80
|
-
# * :title => Watir and Selenium
|
81
|
-
# * :value => Watir only
|
82
|
-
# * :xpath => Watir and Selenium
|
83
|
-
#
|
84
|
-
def text_field_elements(identifier={})
|
85
|
-
platform.text_fields_for(identifier.clone)
|
86
|
-
end
|
87
|
-
|
88
|
-
#
|
89
|
-
# Finds a hidden field
|
90
|
-
#
|
91
|
-
# @param [Hash] identifier how we find a hidden field. You can use a multiple paramaters
|
92
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
93
|
-
# which will find the first hidden field. The valid keys are:
|
94
|
-
# * :class => Watir and Selenium
|
95
|
-
# * :css => Watir and Selenium
|
96
|
-
# * :id => Watir and Selenium
|
97
|
-
# * :index => Watir and Selenium
|
98
|
-
# * :name => Watir and Selenium
|
99
|
-
# * :tag_name => Watir and Selenium
|
100
|
-
# * :text => Watir and Selenium
|
101
|
-
# * :xpath => Watir and Selenium
|
102
|
-
#
|
103
|
-
def hidden_field_element(identifier={:index => 0})
|
104
|
-
platform.hidden_field_for(identifier.clone)
|
105
|
-
end
|
106
|
-
|
107
|
-
#
|
108
|
-
# Finds all hidden fields that match the identifier
|
109
|
-
#
|
110
|
-
# @param [Hash] identifier how we find a hidden field. You can use a multiple paramaters
|
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:
|
113
|
-
# * :class => Watir and Selenium
|
114
|
-
# * :css => Watir and Selenium
|
115
|
-
# * :id => Watir and Selenium
|
116
|
-
# * :index => Watir and Selenium
|
117
|
-
# * :name => Watir and Selenium
|
118
|
-
# * :tag_name => Watir and Selenium
|
119
|
-
# * :text => Watir and Selenium
|
120
|
-
# * :xpath => Watir and Selenium
|
121
|
-
#
|
122
|
-
def hidden_field_elements(identifier={})
|
123
|
-
platform.hidden_fields_for(identifier.clone)
|
124
|
-
end
|
125
|
-
|
126
|
-
#
|
127
|
-
# Finds a text area
|
128
|
-
#
|
129
|
-
# @param [Hash] identifier how we find a text area. You can use a multiple paramaters
|
130
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
131
|
-
# which will return the first text area. The valid keys are:
|
132
|
-
# * :class => Watir and Selenium
|
133
|
-
# * :css => Watir and Selenium
|
134
|
-
# * :id => Watir and Selenium
|
135
|
-
# * :index => Watir and Selenium
|
136
|
-
# * :name => Watir and Selenium
|
137
|
-
# * :tag_name => Watir and Selenium
|
138
|
-
# * :xpath => Watir and Selenium
|
139
|
-
#
|
140
|
-
def text_area_element(identifier={:index => 0})
|
141
|
-
platform.text_area_for(identifier.clone)
|
142
|
-
end
|
143
|
-
|
144
|
-
#
|
145
|
-
# Finds all text areas for the provided identifier
|
146
|
-
#
|
147
|
-
# @param [Hash] identifier how we find a text area. You can use a multiple paramaters
|
148
|
-
# by combining of any of the following except xpath. It defaults to an empty hash
|
149
|
-
# which will return all text areas. The valid keys are:
|
150
|
-
# * :class => Watir and Selenium
|
151
|
-
# * :css => Watir and Selenium
|
152
|
-
# * :id => Watir and Selenium
|
153
|
-
# * :index => Watir and Selenium
|
154
|
-
# * :name => Watir and Selenium
|
155
|
-
# * :tag_name => Watir and Selenium
|
156
|
-
# * :xpath => Watir and Selenium
|
157
|
-
#
|
158
|
-
def text_area_elements(identifier={})
|
159
|
-
platform.text_areas_for(identifier.clone)
|
160
|
-
end
|
161
|
-
|
162
|
-
#
|
163
|
-
# Finds a select list
|
164
|
-
#
|
165
|
-
# @param [Hash] identifier how we find a select list. You can use a multiple paramaters
|
166
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
167
|
-
# which will select the first select list. The valid keys are:
|
168
|
-
# * :class => Watir and Selenium
|
169
|
-
# * :id => Watir and Selenium
|
170
|
-
# * :index => Watir and Selenium
|
171
|
-
# * :name => Watir and Selenium
|
172
|
-
# * :text => Watir only
|
173
|
-
# * :value => Watir only
|
174
|
-
# * :xpath => Watir and Selenium
|
175
|
-
#
|
176
|
-
def select_list_element(identifier={:index => 0})
|
177
|
-
platform.select_list_for(identifier.clone)
|
178
|
-
end
|
179
|
-
|
180
|
-
#
|
181
|
-
# Finds all select lists for the provided identifier
|
182
|
-
#
|
183
|
-
# @param [Hash] identifier how we find a select list. You can use a multiple paramaters
|
184
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
185
|
-
# which will return all select lists. The valid keys are:
|
186
|
-
# * :class => Watir and Selenium
|
187
|
-
# * :id => Watir and Selenium
|
188
|
-
# * :index => Watir and Selenium
|
189
|
-
# * :name => Watir and Selenium
|
190
|
-
# * :text => Watir only
|
191
|
-
# * :value => Watir only
|
192
|
-
# * :xpath => Watir and Selenium
|
193
|
-
#
|
194
|
-
def select_list_elements(identifier={})
|
195
|
-
platform.select_lists_for(identifier.clone)
|
196
|
-
end
|
197
|
-
|
198
|
-
#
|
199
|
-
# Finds a link
|
200
|
-
#
|
201
|
-
# @param [Hash] identifier how we find a link. You can use a multiple paramaters
|
202
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
203
|
-
# which will select the first link. The valid keys are:
|
204
|
-
# * :class => Watir and Selenium
|
205
|
-
# * :css => Watir and Selenium
|
206
|
-
# * :href => Watir and Selenium
|
207
|
-
# * :id => Watir and Selenium
|
208
|
-
# * :index => Watir and Selenium
|
209
|
-
# * :link => Watir and Selenium
|
210
|
-
# * :link_text => Watir and Selenium
|
211
|
-
# * :name => Watir and Selenium
|
212
|
-
# * :text => Watir and Selenium
|
213
|
-
# * :xpath => Watir and Selenium
|
214
|
-
#
|
215
|
-
def link_element(identifier={:index => 0})
|
216
|
-
platform.link_for(identifier.clone)
|
217
|
-
end
|
218
|
-
|
219
|
-
#
|
220
|
-
# Find all links for the provided identifier
|
221
|
-
#
|
222
|
-
# @param [Hash] identifier how we find a link. You can use a multiple paramaters
|
223
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
224
|
-
# which will return all links. The valid keys are:
|
225
|
-
# * :class => Watir and Selenium
|
226
|
-
# * :css => Watir and Selenium
|
227
|
-
# * :href => Watir and Selenium
|
228
|
-
# * :id => Watir and Selenium
|
229
|
-
# * :index => Watir and Selenium
|
230
|
-
# * :link => Watir and Selenium
|
231
|
-
# * :link_text => Watir and Selenium
|
232
|
-
# * :name => Watir and Selenium
|
233
|
-
# * :text => Watir and Selenium
|
234
|
-
# * :xpath => Watir and Selenium
|
235
|
-
#
|
236
|
-
def link_elements(identifier={})
|
237
|
-
platform.links_for(identifier.clone)
|
238
|
-
end
|
239
|
-
|
240
|
-
#
|
241
|
-
# Finds a checkbox
|
242
|
-
#
|
243
|
-
# @param [Hash] identifier how we find a checkbox. You can use a multiple paramaters
|
244
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
245
|
-
# which will return the first checkbox. The valid keys are:
|
246
|
-
# * :class => Watir and Selenium
|
247
|
-
# * :id => Watir and Selenium
|
248
|
-
# * :index => Watir and Selenium
|
249
|
-
# * :name => Watir and Selenium
|
250
|
-
# * :xpath => Watir and Selenium
|
251
|
-
#
|
252
|
-
def checkbox_element(identifier={:index => 0})
|
253
|
-
platform.checkbox_for(identifier.clone)
|
254
|
-
end
|
255
|
-
|
256
|
-
#
|
257
|
-
# Finds all checkbox elements for the provided identifier
|
258
|
-
#
|
259
|
-
# @param [Hash] identifier how we find a checkbox. You can use a multiple paramaters
|
260
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
261
|
-
# which will return all checkboxes. The valid keys are:
|
262
|
-
# * :class => Watir and Selenium
|
263
|
-
# * :id => Watir and Selenium
|
264
|
-
# * :index => Watir and Selenium
|
265
|
-
# * :name => Watir and Selenium
|
266
|
-
# * :xpath => Watir and Selenium
|
267
|
-
#
|
268
|
-
def checkbox_elements(identifier={})
|
269
|
-
platform.checkboxes_for(identifier.clone)
|
270
|
-
end
|
271
|
-
|
272
|
-
#
|
273
|
-
# Finds a radio button
|
274
|
-
#
|
275
|
-
# @param [Hash] identifier how we find a radio button. You can use a multiple paramaters
|
276
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
277
|
-
# which will return the first radio button. The valid keys are:
|
278
|
-
# * :class => Watir and Selenium
|
279
|
-
# * :id => Watir and Selenium
|
280
|
-
# * :index => Watir and Selenium
|
281
|
-
# * :name => Watir and Selenium
|
282
|
-
# * :xpath => Watir and Selenium
|
283
|
-
#
|
284
|
-
def radio_button_element(identifier={:index => 0})
|
285
|
-
platform.radio_button_for(identifier.clone)
|
286
|
-
end
|
287
|
-
|
288
|
-
#
|
289
|
-
# Finds all radio button elements that match the provided identifier
|
290
|
-
#
|
291
|
-
# @param [Hash] identifier how we find a radio button. You can use a multiple paramaters
|
292
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
293
|
-
# which will return all radio buttons. The valid keys are:
|
294
|
-
# * :class => Watir and Selenium
|
295
|
-
# * :id => Watir and Selenium
|
296
|
-
# * :index => Watir and Selenium
|
297
|
-
# * :name => Watir and Selenium
|
298
|
-
# * :xpath => Watir and Selenium
|
299
|
-
#
|
300
|
-
def radio_button_elements(identifier={})
|
301
|
-
platform.radio_buttons_for(identifier.clone)
|
302
|
-
end
|
303
|
-
|
304
|
-
#
|
305
|
-
# Finds a div
|
306
|
-
#
|
307
|
-
# @param [Hash] identifier how we find a div. You can use a multiple paramaters
|
308
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
309
|
-
# which will return the first div. The valid keys are:
|
310
|
-
# * :class => Watir and Selenium
|
311
|
-
# * :id => Watir and Selenium
|
312
|
-
# * :index => Watir and Selenium
|
313
|
-
# * :name => Watir and Selenium
|
314
|
-
# * :text => Watir and Selenium
|
315
|
-
# * :xpath => Watir and Selenium
|
316
|
-
#
|
317
|
-
def div_element(identifier={:index => 0})
|
318
|
-
platform.div_for(identifier.clone)
|
319
|
-
end
|
320
|
-
|
321
|
-
#
|
322
|
-
# Finds all divs that match the provided identifier
|
323
|
-
#
|
324
|
-
# @param [Hash] identifier how we find a div. You can use a multiple paramaters
|
325
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
326
|
-
# which will return all divs. The valid keys are:
|
327
|
-
# * :class => Watir and Selenium
|
328
|
-
# * :id => Watir and Selenium
|
329
|
-
# * :index => Watir and Selenium
|
330
|
-
# * :name => Watir and Selenium
|
331
|
-
# * :text => Watir and Selenium
|
332
|
-
# * :xpath => Watir and Selenium
|
333
|
-
#
|
334
|
-
def div_elements(identifier={})
|
335
|
-
platform.divs_for(identifier.clone)
|
336
|
-
end
|
337
|
-
|
338
|
-
#
|
339
|
-
# Finds a span
|
340
|
-
#
|
341
|
-
# @param [Hash] identifier how we find a span. You can use a multiple paramaters
|
342
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
343
|
-
# which will return the first span element. The valid keys are:
|
344
|
-
# * :class => Watir and Selenium
|
345
|
-
# * :id => Watir and Selenium
|
346
|
-
# * :index => Watir and Selenium
|
347
|
-
# * :name => Watir and Selenium
|
348
|
-
# * :xpath => Watir and Selenium
|
349
|
-
#
|
350
|
-
def span_element(identifier={:index => 0})
|
351
|
-
platform.span_for(identifier.clone)
|
352
|
-
end
|
353
|
-
|
354
|
-
#
|
355
|
-
# Finds all span elements that match the provided identifier
|
356
|
-
#
|
357
|
-
# @param [Hash] identifier how we find a span. You can use a multiple paramaters
|
358
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
359
|
-
# which will return all of the spans. The valid keys are:
|
360
|
-
# * :class => Watir and Selenium
|
361
|
-
# * :id => Watir and Selenium
|
362
|
-
# * :index => Watir and Selenium
|
363
|
-
# * :name => Watir and Selenium
|
364
|
-
# * :xpath => Watir and Selenium
|
365
|
-
#
|
366
|
-
def span_elements(identifier={})
|
367
|
-
platform.spans_for(identifier.clone)
|
368
|
-
end
|
369
|
-
|
370
|
-
#
|
371
|
-
# Finds a table
|
372
|
-
#
|
373
|
-
# @param [Hash] identifier how we find a table. You can use a multiple paramaters
|
374
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
375
|
-
# which will return the first table. The valid keys are:
|
376
|
-
# * :class => Watir and Selenium
|
377
|
-
# * :id => Watir and Selenium
|
378
|
-
# * :index => Watir and Selenium
|
379
|
-
# * :name => Watir and Selenium
|
380
|
-
# * :xpath => Watir and Selenium
|
381
|
-
#
|
382
|
-
def table_element(identifier={:index => 0})
|
383
|
-
platform.table_for(identifier.clone)
|
384
|
-
end
|
385
|
-
|
386
|
-
#
|
387
|
-
# Finds all tables that match the provided identifier
|
388
|
-
#
|
389
|
-
# @param [Hash] identifier how we find a table. You can use a multiple paramaters
|
390
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
391
|
-
# which will return all tables. The valid keys are:
|
392
|
-
# * :class => Watir and Selenium
|
393
|
-
# * :id => Watir and Selenium
|
394
|
-
# * :index => Watir and Selenium
|
395
|
-
# * :name => Watir and Selenium
|
396
|
-
# * :xpath => Watir and Selenium
|
397
|
-
#
|
398
|
-
def table_elements(identifier={})
|
399
|
-
platform.tables_for(identifier.clone)
|
400
|
-
end
|
401
|
-
|
402
|
-
#
|
403
|
-
# Finds a table cell
|
404
|
-
#
|
405
|
-
# @param [Hash] identifier how we find a cell. You can use a multiple paramaters
|
406
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
407
|
-
# which will return the first cell. The valid keys are:
|
408
|
-
# * :class => Watir and Selenium
|
409
|
-
# * :id => Watir and Selenium
|
410
|
-
# * :index => Watir only
|
411
|
-
# * :name => Watir and Selenium
|
412
|
-
# * :text => Watir and Selenium
|
413
|
-
# * :xpath => Watir and Selenium
|
414
|
-
#
|
415
|
-
def cell_element(identifier={:index => 0})
|
416
|
-
platform.cell_for(identifier.clone)
|
417
|
-
end
|
418
|
-
|
419
|
-
#
|
420
|
-
# Finds all table cell elements that match the provided identifier
|
421
|
-
#
|
422
|
-
# @param [Hash] identifier how we find a cell. You can use a multiple paramaters
|
423
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
424
|
-
# which will return all table cells. The valid keys are:
|
425
|
-
# * :class => Watir and Selenium
|
426
|
-
# * :id => Watir and Selenium
|
427
|
-
# * :index => Watir only
|
428
|
-
# * :name => Watir and Selenium
|
429
|
-
# * :text => Watir and Selenium
|
430
|
-
# * :xpath => Watir and Selenium
|
431
|
-
#
|
432
|
-
def cell_elements(identifier={})
|
433
|
-
platform.cells_for(identifier.clone)
|
434
|
-
end
|
435
|
-
|
436
|
-
#
|
437
|
-
# Finds an image
|
438
|
-
#
|
439
|
-
# @param [Hash] identifier how we find an image. You can use a multiple paramaters
|
440
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
441
|
-
# which will return the first image. The valid keys are:
|
442
|
-
# * :class => Watir and Selenium
|
443
|
-
# * :id => Watir and Selenium
|
444
|
-
# * :index => Watir and Selenium
|
445
|
-
# * :name => Watir and Selenium
|
446
|
-
# * :xpath => Watir and Selenium
|
447
|
-
#
|
448
|
-
def image_element(identifier={:index => 0})
|
449
|
-
platform.image_for(identifier.clone)
|
450
|
-
end
|
451
|
-
|
452
|
-
#
|
453
|
-
# Finds all images that match the provided identifier
|
454
|
-
#
|
455
|
-
# @param [Hash] identifier how we find an image. You can use a multiple paramaters
|
456
|
-
# by combining of any of the following except xpath. It defaults to an empth Hash
|
457
|
-
# which will return all images. The valid keys are:
|
458
|
-
# * :class => Watir and Selenium
|
459
|
-
# * :id => Watir and Selenium
|
460
|
-
# * :index => Watir and Selenium
|
461
|
-
# * :name => Watir and Selenium
|
462
|
-
# * :xpath => Watir and Selenium
|
463
|
-
#
|
464
|
-
def image_elements(identifier={})
|
465
|
-
platform.images_for(identifier.clone)
|
466
|
-
end
|
467
|
-
|
468
|
-
#
|
469
|
-
# Finds a form
|
470
|
-
#
|
471
|
-
# @param [Hash] identifier how we find a form. You can use a multiple paramaters
|
472
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
473
|
-
# which will return the first form. The valid keys are:
|
474
|
-
# * :class => Watir and Selenium
|
475
|
-
# * :id => Watir and Selenium
|
476
|
-
# * :index => Watir and Selenium
|
477
|
-
# * :xpath => Watir and Selenium
|
478
|
-
#
|
479
|
-
def form_element(identifier={:index => 0})
|
480
|
-
platform.form_for(identifier.clone)
|
481
|
-
end
|
482
|
-
|
483
|
-
#
|
484
|
-
# Finds all forms that match the provided identifier
|
485
|
-
#
|
486
|
-
# @param [Hash] identifier how we find a form. You can use a multiple paramaters
|
487
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
488
|
-
# which will return all forms. The valid keys are:
|
489
|
-
# * :class => Watir and Selenium
|
490
|
-
# * :id => Watir and Selenium
|
491
|
-
# * :index => Watir and Selenium
|
492
|
-
# * :xpath => Watir and Selenium
|
493
|
-
#
|
494
|
-
def form_elements(identifier={})
|
495
|
-
platform.forms_for(identifier.clone)
|
496
|
-
end
|
497
|
-
|
498
|
-
#
|
499
|
-
# Finds a list item
|
500
|
-
#
|
501
|
-
# @param [Hash] identifier how we find a list item. You can use a multiple paramaters
|
502
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
503
|
-
# whcih will return the first list item. The valid keys are:
|
504
|
-
# * :class => Watir and Selenium
|
505
|
-
# * :id => Watir and Selenium
|
506
|
-
# * :index => Watir and Selenium
|
507
|
-
# * :name => Watir and Selenium
|
508
|
-
# * :xpath => Watir and Selenium
|
509
|
-
#
|
510
|
-
def list_item_element(identifier={:index => 0})
|
511
|
-
platform.list_item_for(identifier.clone)
|
512
|
-
end
|
513
|
-
|
514
|
-
#
|
515
|
-
# Finds all list items that match the identifier
|
516
|
-
#
|
517
|
-
# @param [Hash] identifier how we find a list item. You can use a multiple paramaters
|
518
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
519
|
-
# which will return all list items. The valid keys are:
|
520
|
-
# * :class => Watir and Selenium
|
521
|
-
# * :id => Watir and Selenium
|
522
|
-
# * :index => Watir and Selenium
|
523
|
-
# * :name => Watir and Selenium
|
524
|
-
# * :xpath => Watir and Selenium
|
525
|
-
#
|
526
|
-
def list_item_elements(identifier={})
|
527
|
-
platform.list_items_for(identifier.clone)
|
528
|
-
end
|
529
|
-
|
530
|
-
#
|
531
|
-
# Finds an unordered list
|
532
|
-
#
|
533
|
-
# @param [Hash] identifier how we find an unordered list. You can use a multiple paramaters
|
534
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
535
|
-
# which will return the first unordered list. The valid keys are:
|
536
|
-
# * :class => Watir and Selenium
|
537
|
-
# * :id => Watir and Selenium
|
538
|
-
# * :index => Watir and Selenium
|
539
|
-
# * :name => Watir and Selenium
|
540
|
-
# * :xpath => Watir and Selenium
|
541
|
-
#
|
542
|
-
def unordered_list_element(identifier={:index => 0})
|
543
|
-
platform.unordered_list_for(identifier.clone)
|
544
|
-
end
|
545
|
-
|
546
|
-
#
|
547
|
-
# Finds all unordered lists that match the identifier
|
548
|
-
#
|
549
|
-
# @param [Hash] identifier how we find an unordered list. You can use a multiple paramaters
|
550
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
551
|
-
# which will return all unordered lists. The valid keys are:
|
552
|
-
# * :class => Watir and Selenium
|
553
|
-
# * :id => Watir and Selenium
|
554
|
-
# * :index => Watir and Selenium
|
555
|
-
# * :name => Watir and Selenium
|
556
|
-
# * :xpath => Watir and Selenium
|
557
|
-
#
|
558
|
-
def unordered_list_elements(identifier={})
|
559
|
-
platform.unordered_lists_for(identifier.clone)
|
560
|
-
end
|
561
|
-
|
562
|
-
#
|
563
|
-
# Finds an ordered list
|
564
|
-
#
|
565
|
-
# @param [Hash] identifier how we find an ordered list. You can use a multiple paramaters
|
566
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
567
|
-
# whcih will return the first ordered list. The valid keys are:
|
568
|
-
# * :class => Watir and Selenium
|
569
|
-
# * :id => Watir and Selenium
|
570
|
-
# * :index => Watir and Selenium
|
571
|
-
# * :name => Watir and Selenium
|
572
|
-
# * :xpath => Watir and Selenium
|
573
|
-
#
|
574
|
-
def ordered_list_element(identifier={:index => 0})
|
575
|
-
platform.ordered_list_for(identifier.clone)
|
576
|
-
end
|
577
|
-
|
578
|
-
#
|
579
|
-
# Finds all ordered lists that match the identifier
|
580
|
-
#
|
581
|
-
# @param [Hash] identifier how we find an ordered list. You can use a multiple paramaters
|
582
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
583
|
-
# which returns all ordered lists. The valid keys are:
|
584
|
-
# * :class => Watir and Selenium
|
585
|
-
# * :id => Watir and Selenium
|
586
|
-
# * :index => Watir and Selenium
|
587
|
-
# * :name => Watir and Selenium
|
588
|
-
# * :xpath => Watir and Selenium
|
589
|
-
#
|
590
|
-
def ordered_list_elements(identifier={})
|
591
|
-
platform.ordered_lists_for(identifier.clone)
|
592
|
-
end
|
593
|
-
|
594
|
-
#
|
595
|
-
# Finds a h1
|
596
|
-
#
|
597
|
-
# @param [Hash] identifier how we find a H1. You can use a multiple paramaters
|
598
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
599
|
-
# which will return the first h1. The valid keys are:
|
600
|
-
# * :class => Watir and Selenium
|
601
|
-
# * :id => Watir and Selenium
|
602
|
-
# * :index => Watir and Selenium
|
603
|
-
# * :name => Watir and Selenium
|
604
|
-
# * :xpath => Watir and Selenium
|
605
|
-
#
|
606
|
-
def h1_element(identifier={:index => 0})
|
607
|
-
platform.h1_for(identifier.clone)
|
608
|
-
end
|
609
|
-
|
610
|
-
#
|
611
|
-
# Finds all h1 elements matching the identifier
|
612
|
-
#
|
613
|
-
# @param [Hash] identifier how we find a H1. You can use a multiple paramaters
|
614
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
615
|
-
# which will return all h1s. The valid keys are:
|
616
|
-
# * :class => Watir and Selenium
|
617
|
-
# * :id => Watir and Selenium
|
618
|
-
# * :index => Watir and Selenium
|
619
|
-
# * :name => Watir and Selenium
|
620
|
-
# * :xpath => Watir and Selenium
|
621
|
-
#
|
622
|
-
def h1_elements(identifier={})
|
623
|
-
platform.h1s_for(identifier.clone)
|
624
|
-
end
|
625
|
-
|
626
|
-
#
|
627
|
-
# Finds a h2
|
628
|
-
#
|
629
|
-
# @param [Hash] identifier how we find a H2. You can use a multiple paramaters
|
630
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
631
|
-
# which will return the first h2. The valid keys are:
|
632
|
-
# * :class => Watir and Selenium
|
633
|
-
# * :id => Watir and Selenium
|
634
|
-
# * :index => Watir and Selenium
|
635
|
-
# * :name => Watir and Selenium
|
636
|
-
# * :xpath => Watir and Selenium
|
637
|
-
#
|
638
|
-
def h2_element(identifier={:index => 0})
|
639
|
-
platform.h2_for(identifier.clone)
|
640
|
-
end
|
641
|
-
|
642
|
-
#
|
643
|
-
# Finds all h2 elements matching the identifier
|
644
|
-
#
|
645
|
-
# @param [Hash] identifier how we find a H2. You can use a multiple paramaters
|
646
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
647
|
-
# which will return all h2s. The valid keys are:
|
648
|
-
# * :class => Watir and Selenium
|
649
|
-
# * :id => Watir and Selenium
|
650
|
-
# * :index => Watir and Selenium
|
651
|
-
# * :name => Watir and Selenium
|
652
|
-
# * :xpath => Watir and Selenium
|
653
|
-
#
|
654
|
-
def h2_elements(identifier={})
|
655
|
-
platform.h2s_for(identifier.clone)
|
656
|
-
end
|
657
|
-
|
658
|
-
#
|
659
|
-
# Finds a h3
|
660
|
-
#
|
661
|
-
# @param [Hash] identifier how we find a H3. You can use a multiple paramaters
|
662
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
663
|
-
# which will return the first h3. The valid keys are:
|
664
|
-
# * :class => Watir and Selenium
|
665
|
-
# * :id => Watir and Selenium
|
666
|
-
# * :index => Watir and Selenium
|
667
|
-
# * :name => Watir and Selenium
|
668
|
-
# * :xpath => Watir and Selenium
|
669
|
-
#
|
670
|
-
def h3_element(identifier={:index => 0})
|
671
|
-
platform.h3_for(identifier.clone)
|
672
|
-
end
|
673
|
-
|
674
|
-
#
|
675
|
-
# Finds all h3 elements for the identifier
|
676
|
-
#
|
677
|
-
# @param [Hash] identifier how we find a H3. You can use a multiple paramaters
|
678
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
679
|
-
# which will return all h3s. The valid keys are:
|
680
|
-
# * :class => Watir and Selenium
|
681
|
-
# * :id => Watir and Selenium
|
682
|
-
# * :index => Watir and Selenium
|
683
|
-
# * :name => Watir and Selenium
|
684
|
-
# * :xpath => Watir and Selenium
|
685
|
-
#
|
686
|
-
def h3_elements(identifier={})
|
687
|
-
platform.h3s_for(identifier.clone)
|
688
|
-
end
|
689
|
-
|
690
|
-
#
|
691
|
-
# Finds a h4
|
692
|
-
#
|
693
|
-
# @param [Hash] identifier how we find a H4. You can use a multiple paramaters
|
694
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
695
|
-
# which will select the first h4. The valid keys are:
|
696
|
-
# * :class => Watir and Selenium
|
697
|
-
# * :id => Watir and Selenium
|
698
|
-
# * :index => Watir and Selenium
|
699
|
-
# * :name => Watir and Selenium
|
700
|
-
# * :xpath => Watir and Selenium
|
701
|
-
#
|
702
|
-
def h4_element(identifier={:index => 0})
|
703
|
-
platform.h4_for(identifier.clone)
|
704
|
-
end
|
705
|
-
|
706
|
-
#
|
707
|
-
# Finds all h4 elements matching the identifier
|
708
|
-
#
|
709
|
-
# @param [Hash] identifier how we find a H4. You can use a multiple paramaters
|
710
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
711
|
-
# which will select all h4s. The valid keys are:
|
712
|
-
# * :class => Watir and Selenium
|
713
|
-
# * :id => Watir and Selenium
|
714
|
-
# * :index => Watir and Selenium
|
715
|
-
# * :name => Watir and Selenium
|
716
|
-
# * :xpath => Watir and Selenium
|
717
|
-
#
|
718
|
-
def h4_elements(identifier={})
|
719
|
-
platform.h4s_for(identifier.clone)
|
720
|
-
end
|
721
|
-
|
722
|
-
#
|
723
|
-
# Finds a h5
|
724
|
-
#
|
725
|
-
# @param [Hash] identifier how we find a H5. You can use a multiple paramaters
|
726
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
727
|
-
# which will return the first h5 element. The valid keys are:
|
728
|
-
# * :class => Watir and Selenium
|
729
|
-
# * :id => Watir and Selenium
|
730
|
-
# * :index => Watir and Selenium
|
731
|
-
# * :name => Watir and Selenium
|
732
|
-
# * :xpath => Watir and Selenium
|
733
|
-
#
|
734
|
-
def h5_element(identifier={:index => 0})
|
735
|
-
platform.h5_for(identifier.clone)
|
736
|
-
end
|
737
|
-
|
738
|
-
#
|
739
|
-
# Finds all h5 elements for the identifier
|
740
|
-
#
|
741
|
-
# @param [Hash] identifier how we find a H5. You can use a multiple paramaters
|
742
|
-
# by combining of any of the following except xpath. It defaults to using an empty Hash
|
743
|
-
# which will return all h5 elements. The valid keys are:
|
744
|
-
# * :class => Watir and Selenium
|
745
|
-
# * :id => Watir and Selenium
|
746
|
-
# * :index => Watir and Selenium
|
747
|
-
# * :name => Watir and Selenium
|
748
|
-
# * :xpath => Watir and Selenium
|
749
|
-
#
|
750
|
-
def h5_elements(identifier={})
|
751
|
-
platform.h5s_for(identifier.clone)
|
752
|
-
end
|
753
|
-
|
754
|
-
#
|
755
|
-
# Finds a h6
|
756
|
-
#
|
757
|
-
# @param [Hash] identifier how we find a H6. You can use a multiple paramaters
|
758
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
759
|
-
# which will return the first h6 element. The valid keys are:
|
760
|
-
# * :class => Watir and Selenium
|
761
|
-
# * :id => Watir and Selenium
|
762
|
-
# * :index => Watir and Selenium
|
763
|
-
# * :name => Watir and Selenium
|
764
|
-
# * :xpath => Watir and Selenium
|
765
|
-
#
|
766
|
-
def h6_element(identifier={:index => 0})
|
767
|
-
platform.h6_for(identifier.clone)
|
768
|
-
end
|
769
|
-
|
770
|
-
#
|
771
|
-
# Finds all h6 elements matching the identifier
|
772
|
-
#
|
773
|
-
# @param [Hash] identifier how we find a H6. You can use a multiple paramaters
|
774
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
775
|
-
# which will return all h6 elements. The valid keys are:
|
776
|
-
# * :class => Watir and Selenium
|
777
|
-
# * :id => Watir and Selenium
|
778
|
-
# * :index => Watir and Selenium
|
779
|
-
# * :name => Watir and Selenium
|
780
|
-
# * :xpath => Watir and Selenium
|
781
|
-
#
|
782
|
-
def h6_elements(identifier={})
|
783
|
-
platform.h6s_for(identifier.clone)
|
784
|
-
end
|
785
|
-
|
786
|
-
#
|
787
|
-
# Finds a paragraph
|
788
|
-
#
|
789
|
-
# @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters
|
790
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
791
|
-
# which will return the first paragraph. The valid keys are:
|
792
|
-
# * :class => Watir and Selenium
|
793
|
-
# * :id => Watir and Selenium
|
794
|
-
# * :index => Watir and Selenium
|
795
|
-
# * :name => Watir and Selenium
|
796
|
-
# * :xpath => Watir and Selenium
|
797
|
-
#
|
798
|
-
def paragraph_element(identifier={:index => 0})
|
799
|
-
platform.paragraph_for(identifier.clone)
|
800
|
-
end
|
801
5
|
|
802
|
-
|
803
|
-
|
804
|
-
#
|
805
|
-
# @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters
|
806
|
-
# by combining of any of the following except xpath. It defaults to an empty Hash
|
807
|
-
# which will return all paragraphs. The valid keys are:
|
808
|
-
# * :class => Watir and Selenium
|
809
|
-
# * :id => Watir and Selenium
|
810
|
-
# * :index => Watir and Selenium
|
811
|
-
# * :name => Watir and Selenium
|
812
|
-
# * :xpath => Watir and Selenium
|
813
|
-
#
|
814
|
-
def paragraph_elements(identifier={})
|
815
|
-
platform.paragraphs_for(identifier.clone)
|
6
|
+
def self.included(cls)
|
7
|
+
::PageObject::LocatorGenerator.generate_locators(cls)
|
816
8
|
end
|
817
9
|
|
818
|
-
|
819
|
-
|
820
|
-
#
|
821
|
-
# @param [Hash] identifier how we find a label. You can use a multiple paramaters
|
822
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
823
|
-
# whcih will return the first label. The valid keys are:
|
824
|
-
# * :class => Watir and Selenium
|
825
|
-
# * :id => Watir and Selenium
|
826
|
-
# * :index => Watir and Selenium
|
827
|
-
# * :name => Watir and Selenium
|
828
|
-
# * :text => Watir and Selenium
|
829
|
-
# * :xpath => Watir and Selenium
|
830
|
-
#
|
831
|
-
def label_element(identifier={:index => 0})
|
832
|
-
platform.label_for(identifier.clone)
|
833
|
-
end
|
834
|
-
|
835
|
-
#
|
836
|
-
# Finds all labels that match the provided identifier
|
837
|
-
#
|
838
|
-
# @param [Hash] identifier how we find a label. You can use a multiple paramaters
|
839
|
-
# by combining of any of the following except xpath. It defaults to an empty hash
|
840
|
-
# which returns all labels. The valid keys are:
|
841
|
-
# * :class => Watir and Selenium
|
842
|
-
# * :id => Watir and Selenium
|
843
|
-
# * :index => Watir and Selenium
|
844
|
-
# * :name => Watir and Selenium
|
845
|
-
# * :text => Watir and Selenium
|
846
|
-
# * :xpath => Watir and Selenium
|
847
|
-
#
|
848
|
-
def label_elements(identifier={})
|
849
|
-
platform.labels_for(identifier.clone)
|
850
|
-
end
|
851
|
-
|
852
|
-
#
|
853
|
-
# Finds a file field
|
854
|
-
#
|
855
|
-
# @param [Hash] identifier how we find a file field. You can use a multiple paramaters
|
856
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
857
|
-
# which will return the first file field. The valid keys are:
|
858
|
-
# * :class => Watir and Selenium
|
859
|
-
# * :id => Watir and Selenium
|
860
|
-
# * :index => Watir and Selenium
|
861
|
-
# * :name => Watir and Selenium
|
862
|
-
# * :title => Watir and Selenium
|
863
|
-
# * :xpath => Watir and Selenium
|
864
|
-
def file_field_element(identifier={:index => 0})
|
865
|
-
platform.file_field_for(identifier.clone)
|
866
|
-
end
|
867
|
-
|
868
|
-
#
|
869
|
-
# Finds all file fields that match the provided identifier
|
870
|
-
#
|
871
|
-
# @param [Hash] identifier how we find a file field. You can use a multiple paramaters
|
872
|
-
# by combining of any of the following except xpath. It defaults to and empty Hash
|
873
|
-
# which will return all file fields. The valid keys are:
|
874
|
-
# * :class => Watir and Selenium
|
875
|
-
# * :id => Watir and Selenium
|
876
|
-
# * :index => Watir and Selenium
|
877
|
-
# * :name => Watir and Selenium
|
878
|
-
# * :title => Watir and Selenium
|
879
|
-
# * :xpath => Watir and Selenium
|
880
|
-
def file_field_elements(identifier={})
|
881
|
-
platform.file_fields_for(identifier.clone)
|
882
|
-
end
|
883
|
-
|
884
|
-
#
|
885
|
-
# Finds an area
|
886
|
-
#
|
887
|
-
# @param [Hash] identifier how we find an area. You can use a multiple paramaters
|
888
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
889
|
-
# which will return the first file field. The valid keys are:
|
890
|
-
# * :class => Watir and Selenium
|
891
|
-
# * :id => Watir and Selenium
|
892
|
-
# * :index => Watir and Selenium
|
893
|
-
# * :name => Watir and Selenium
|
894
|
-
# * :xpath => Watir and Selenium
|
895
|
-
def area_element(identifier={:index => 0})
|
896
|
-
platform.area_for(identifier.clone)
|
897
|
-
end
|
898
|
-
|
899
|
-
#
|
900
|
-
# Finds all areas that match the provided identifier
|
901
|
-
#
|
902
|
-
# @param [Hash] identifier how we find an area. You can use a multiple paramaters
|
903
|
-
# by combining of any of the following except xpath. It defaults to and empty Hash
|
904
|
-
# which will return all file fields. The valid keys are:
|
905
|
-
# * :class => Watir and Selenium
|
906
|
-
# * :id => Watir and Selenium
|
907
|
-
# * :index => Watir and Selenium
|
908
|
-
# * :name => Watir and Selenium
|
909
|
-
# * :xpath => Watir and Selenium
|
910
|
-
def area_elements(identifier={})
|
911
|
-
platform.areas_for(identifier.clone)
|
912
|
-
end
|
913
|
-
|
914
|
-
#
|
915
|
-
# Finds a canvas
|
916
|
-
#
|
917
|
-
# @param [Hash] identifier how we find a canvas. You can use a multiple paramaters
|
918
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
919
|
-
# which will return the first file field. The valid keys are:
|
920
|
-
# * :class => Watir and Selenium
|
921
|
-
# * :id => Watir and Selenium
|
922
|
-
# * :index => Watir and Selenium
|
923
|
-
# * :name => Watir and Selenium
|
924
|
-
# * :xpath => Watir and Selenium
|
925
|
-
def canvas_element(identifier={:index => 0})
|
926
|
-
platform.canvas_for(identifier.clone)
|
927
|
-
end
|
928
|
-
|
929
|
-
#
|
930
|
-
# Finds all canvases that match the provided identifier
|
931
|
-
#
|
932
|
-
# @param [Hash] identifier how we find a canvas. You can use a multiple paramaters
|
933
|
-
# by combining of any of the following except xpath. It defaults to and empty Hash
|
934
|
-
# which will return all file fields. The valid keys are:
|
935
|
-
# * :class => Watir and Selenium
|
936
|
-
# * :id => Watir and Selenium
|
937
|
-
# * :index => Watir and Selenium
|
938
|
-
# * :name => Watir and Selenium
|
939
|
-
# * :xpath => Watir and Selenium
|
940
|
-
def canvas_elements(identifier={})
|
941
|
-
platform.canvases_for(identifier.clone)
|
942
|
-
end
|
943
|
-
|
944
|
-
#
|
945
|
-
# Finds an audio element
|
946
|
-
#
|
947
|
-
# @param [Hash] identifier how we find an audio. You can use a multiple paramaters
|
948
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
949
|
-
# which will return the first file field. The valid keys are:
|
950
|
-
# * :class => Watir and Selenium
|
951
|
-
# * :id => Watir and Selenium
|
952
|
-
# * :index => Watir and Selenium
|
953
|
-
# * :name => Watir and Selenium
|
954
|
-
# * :xpath => Watir and Selenium
|
955
|
-
def audio_element(identifier={:index => 0})
|
956
|
-
platform.audio_for(identifier.clone)
|
957
|
-
end
|
958
|
-
|
959
|
-
#
|
960
|
-
# Finds all audio elements that match the provided identifier
|
961
|
-
#
|
962
|
-
# @param [Hash] identifier how we find an audio element. You can use a multiple paramaters
|
963
|
-
# by combining of any of the following except xpath. It defaults to and empty Hash
|
964
|
-
# which will return all file fields. The valid keys are:
|
965
|
-
# * :class => Watir and Selenium
|
966
|
-
# * :id => Watir and Selenium
|
967
|
-
# * :index => Watir and Selenium
|
968
|
-
# * :name => Watir and Selenium
|
969
|
-
# * :xpath => Watir and Selenium
|
970
|
-
def audio_elements(identifier={})
|
971
|
-
platform.audios_for(identifier.clone)
|
10
|
+
def element(tag, identifier={:index => 0})
|
11
|
+
platform.element_for(tag, identifier.clone)
|
972
12
|
end
|
973
13
|
|
974
|
-
|
975
|
-
# Finds a video element
|
976
|
-
#
|
977
|
-
# @param [Hash] identifier how we find a video. You can use a multiple paramaters
|
978
|
-
# by combining of any of the following except xpath. It defaults to {:index => 0}
|
979
|
-
# which will return the first file field. The valid keys are:
|
980
|
-
# * :class => Watir and Selenium
|
981
|
-
# * :id => Watir and Selenium
|
982
|
-
# * :index => Watir and Selenium
|
983
|
-
# * :name => Watir and Selenium
|
984
|
-
# * :xpath => Watir and Selenium
|
985
|
-
def video_element(identifier={:index => 0})
|
986
|
-
platform.video_for(identifier.clone)
|
987
|
-
end
|
14
|
+
private
|
988
15
|
|
989
|
-
|
990
|
-
|
991
|
-
#
|
992
|
-
# @param [Hash] identifier how we find a video element. You can use a multiple paramaters
|
993
|
-
# by combining of any of the following except xpath. It defaults to and empty Hash
|
994
|
-
# which will return all file fields. The valid keys are:
|
995
|
-
# * :class => Watir and Selenium
|
996
|
-
# * :id => Watir and Selenium
|
997
|
-
# * :index => Watir and Selenium
|
998
|
-
# * :name => Watir and Selenium
|
999
|
-
# * :xpath => Watir and Selenium
|
1000
|
-
def video_elements(identifier={})
|
1001
|
-
platform.videos_for(identifier.clone)
|
16
|
+
def locator(identifier)
|
17
|
+
identifier[0] ? identifier[0] : {:index => 0}
|
1002
18
|
end
|
1003
19
|
|
1004
|
-
#
|
1005
|
-
# Finds an element
|
1006
|
-
#
|
1007
|
-
# @param [Symbol] the name of the tag for the element
|
1008
|
-
# @param [Hash] identifier how we find an element. You can use a multiple paramaters
|
1009
|
-
# by combining of any of the following except xpath. The valid keys are:
|
1010
|
-
# * :class => Watir and Selenium
|
1011
|
-
# * :id => Watir and Selenium
|
1012
|
-
# * :index => Watir and Selenium
|
1013
|
-
# * :name => Watir and Selenium
|
1014
|
-
# * :xpath => Watir and Selenium
|
1015
|
-
#
|
1016
|
-
def element(tag, identifier={:index => 0})
|
1017
|
-
platform.element_for(tag, identifier.clone)
|
1018
|
-
end
|
1019
20
|
end
|
1020
21
|
end
|