page-object 0.6.4 → 0.6.5

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