page-object 0.5.5 → 0.6

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.
@@ -36,5 +36,9 @@ module UrlHelper
36
36
  def async
37
37
  "#{files}/async.html"
38
38
  end
39
+
40
+ def multi
41
+ "#{files}/multi_elements.html"
42
+ end
39
43
  end
40
44
  end
@@ -20,7 +20,7 @@ module PageObject
20
20
  platform.navigate_to url
21
21
  end
22
22
  end
23
-
23
+
24
24
  #
25
25
  # Identify an element as existing within a frame or iframe. A frame parameter
26
26
  # is passed to the block and must be passed to the other calls to PageObject.
@@ -19,6 +19,25 @@ module PageObject
19
19
  def button_element(identifier)
20
20
  platform.button_for(identifier.clone)
21
21
  end
22
+
23
+ #
24
+ # Finds all buttons that match the provided identifier
25
+ #
26
+ # @param [Hash] identifier how we find a button. You can use a multiple paramaters
27
+ # by combining of any of the following except xpath. The valid keys are:
28
+ # * :class => Watir and Selenium
29
+ # * :id => Watir and Selenium
30
+ # * :index => Watir and Selenium
31
+ # * :name => Watir and Selenium
32
+ # * :text => Watir only
33
+ # * :value => Watir and Selenium
34
+ # * :xpath => Watir and Selenium
35
+ # * :src => Watir and Selenium (image button only)
36
+ # * :alt => Watir and Selenium (image button only)
37
+ #
38
+ def button_elements(identifier)
39
+ platform.buttons_for(identifier.clone)
40
+ end
22
41
 
23
42
  #
24
43
  # Finds a text field
@@ -40,6 +59,26 @@ module PageObject
40
59
  platform.text_field_for(identifier.clone)
41
60
  end
42
61
 
62
+ #
63
+ # Finds all text fields that match the provided identifier
64
+ #
65
+ # @param [Hash] identifier how we find a text field. You can use a multiple paramaters
66
+ # by combining of any of the following except xpath. The valid keys are:
67
+ # * :class => Watir and Selenium
68
+ # * :css => Watir and Selenium
69
+ # * :id => Watir and Selenium
70
+ # * :index => Watir and Selenium
71
+ # * :name => Watir and Selenium
72
+ # * :tag_name => Watir and Selenium
73
+ # * :text => Watir only
74
+ # * :title => Watir and Selenium
75
+ # * :value => Watir only
76
+ # * :xpath => Watir and Selenium
77
+ #
78
+ def text_field_elements(identifier)
79
+ platform.text_fields_for(identifier.clone)
80
+ end
81
+
43
82
  #
44
83
  # Finds a hidden field
45
84
  #
@@ -58,6 +97,24 @@ module PageObject
58
97
  platform.hidden_field_for(identifier.clone)
59
98
  end
60
99
 
100
+ #
101
+ # Finds all hidden fields that match the identifier
102
+ #
103
+ # @param [Hash] identifier how we find a hidden field. You can use a multiple paramaters
104
+ # by combining of any of the following except xpath. The valid keys are:
105
+ # * :class => Watir and Selenium
106
+ # * :css => Watir and Selenium
107
+ # * :id => Watir and Selenium
108
+ # * :index => Watir and Selenium
109
+ # * :name => Watir and Selenium
110
+ # * :tag_name => Watir and Selenium
111
+ # * :text => Watir and Selenium
112
+ # * :xpath => Watir and Selenium
113
+ #
114
+ def hidden_field_elements(identifier)
115
+ platform.hidden_fields_for(identifier.clone)
116
+ end
117
+
61
118
  #
62
119
  # Finds a text area
63
120
  #
@@ -75,6 +132,23 @@ module PageObject
75
132
  platform.text_area_for(identifier.clone)
76
133
  end
77
134
 
135
+ #
136
+ # Finds all text areas for the provided identifier
137
+ #
138
+ # @param [Hash] identifier how we find a text area. You can use a multiple paramaters
139
+ # by combining of any of the following except xpath. The valid keys are:
140
+ # * :class => Watir and Selenium
141
+ # * :css => Watir and Selenium
142
+ # * :id => Watir and Selenium
143
+ # * :index => Watir and Selenium
144
+ # * :name => Watir and Selenium
145
+ # * :tag_name => Watir and Selenium
146
+ # * :xpath => Watir and Selenium
147
+ #
148
+ def text_area_elements(identifier)
149
+ platform.text_areas_for(identifier.clone)
150
+ end
151
+
78
152
  #
79
153
  # Finds a select list
80
154
  #
@@ -92,6 +166,23 @@ module PageObject
92
166
  platform.select_list_for(identifier.clone)
93
167
  end
94
168
 
169
+ #
170
+ # Finds all select lists for the provided identifier
171
+ #
172
+ # @param [Hash] identifier how we find a select list. You can use a multiple paramaters
173
+ # by combining of any of the following except xpath. The valid keys are:
174
+ # * :class => Watir and Selenium
175
+ # * :id => Watir and Selenium
176
+ # * :index => Watir and Selenium
177
+ # * :name => Watir and Selenium
178
+ # * :text => Watir only
179
+ # * :value => Watir only
180
+ # * :xpath => Watir and Selenium
181
+ #
182
+ def select_list_elements(identifier)
183
+ platform.select_lists_for(identifier.clone)
184
+ end
185
+
95
186
  #
96
187
  # Finds a link
97
188
  #
@@ -111,6 +202,25 @@ module PageObject
111
202
  platform.link_for(identifier.clone)
112
203
  end
113
204
 
205
+ #
206
+ # Find all links for the provided identifier
207
+ #
208
+ # @param [Hash] identifier how we find a link. You can use a multiple paramaters
209
+ # by combining of any of the following except xpath. The valid keys are:
210
+ # * :class => Watir and Selenium
211
+ # * :href => Watir and Selenium
212
+ # * :id => Watir and Selenium
213
+ # * :index => Watir and Selenium
214
+ # * :link => Watir and Selenium
215
+ # * :link_text => Watir and Selenium
216
+ # * :name => Watir and Selenium
217
+ # * :text => Watir and Selenium
218
+ # * :xpath => Watir and Selenium
219
+ #
220
+ def link_elements(identifier)
221
+ platform.links_for(identifier.clone)
222
+ end
223
+
114
224
  #
115
225
  # Finds a checkbox
116
226
  #
@@ -126,6 +236,21 @@ module PageObject
126
236
  platform.checkbox_for(identifier.clone)
127
237
  end
128
238
 
239
+ #
240
+ # Finds all checkbox elements for the provided identifier
241
+ #
242
+ # @param [Hash] identifier how we find a checkbox. You can use a multiple paramaters
243
+ # by combining of any of the following except xpath. The valid keys are:
244
+ # * :class => Watir and Selenium
245
+ # * :id => Watir and Selenium
246
+ # * :index => Watir and Selenium
247
+ # * :name => Watir and Selenium
248
+ # * :xpath => Watir and Selenium
249
+ #
250
+ def checkbox_elements(identifier)
251
+ platform.checkboxes_for(identifier.clone)
252
+ end
253
+
129
254
  #
130
255
  # Finds a radio button
131
256
  #
@@ -141,6 +266,21 @@ module PageObject
141
266
  platform.radio_button_for(identifier.clone)
142
267
  end
143
268
 
269
+ #
270
+ # Finds all radio button elements that match the provided identifier
271
+ #
272
+ # @param [Hash] identifier how we find a radio button. You can use a multiple paramaters
273
+ # by combining of any of the following except xpath. The valid keys are:
274
+ # * :class => Watir and Selenium
275
+ # * :id => Watir and Selenium
276
+ # * :index => Watir and Selenium
277
+ # * :name => Watir and Selenium
278
+ # * :xpath => Watir and Selenium
279
+ #
280
+ def radio_button_elements(identifier)
281
+ platform.radio_buttons_for(identifier.clone)
282
+ end
283
+
144
284
  #
145
285
  # Finds a div
146
286
  #
@@ -157,6 +297,22 @@ module PageObject
157
297
  platform.div_for(identifier.clone)
158
298
  end
159
299
 
300
+ #
301
+ # Finds all divs that match the provided identifier
302
+ #
303
+ # @param [Hash] identifier how we find a div. You can use a multiple paramaters
304
+ # by combining of any of the following except xpath. The valid keys are:
305
+ # * :class => Watir and Selenium
306
+ # * :id => Watir and Selenium
307
+ # * :index => Watir and Selenium
308
+ # * :name => Watir and Selenium
309
+ # * :text => Watir and Selenium
310
+ # * :xpath => Watir and Selenium
311
+ #
312
+ def div_elements(identifier)
313
+ platform.divs_for(identifier.clone)
314
+ end
315
+
160
316
  #
161
317
  # Finds a span
162
318
  #
@@ -172,6 +328,21 @@ module PageObject
172
328
  platform.span_for(identifier.clone)
173
329
  end
174
330
 
331
+ #
332
+ # Finds all span elements that match the provided identifier
333
+ #
334
+ # @param [Hash] identifier how we find a span. You can use a multiple paramaters
335
+ # by combining of any of the following except xpath. The valid keys are:
336
+ # * :class => Watir and Selenium
337
+ # * :id => Watir and Selenium
338
+ # * :index => Watir and Selenium
339
+ # * :name => Watir and Selenium
340
+ # * :xpath => Watir and Selenium
341
+ #
342
+ def span_elements(identifier)
343
+ platform.spans_for(identifier.clone)
344
+ end
345
+
175
346
  #
176
347
  # Finds a table
177
348
  #
@@ -187,6 +358,21 @@ module PageObject
187
358
  platform.table_for(identifier.clone)
188
359
  end
189
360
 
361
+ #
362
+ # Finds all tables that match the provided identifier
363
+ #
364
+ # @param [Hash] identifier how we find a table. You can use a multiple paramaters
365
+ # by combining of any of the following except xpath. The valid keys are:
366
+ # * :class => Watir and Selenium
367
+ # * :id => Watir and Selenium
368
+ # * :index => Watir and Selenium
369
+ # * :name => Watir and Selenium
370
+ # * :xpath => Watir and Selenium
371
+ #
372
+ def table_elements(identifier)
373
+ platform.tables_for(identifier.clone)
374
+ end
375
+
190
376
  #
191
377
  # Finds a table cell
192
378
  #
@@ -203,6 +389,22 @@ module PageObject
203
389
  platform.cell_for(identifier.clone)
204
390
  end
205
391
 
392
+ #
393
+ # Finds all table cell elements that match the provided identifier
394
+ #
395
+ # @param [Hash] identifier how we find a cell. You can use a multiple paramaters
396
+ # by combining of any of the following except xpath. The valid keys are:
397
+ # * :class => Watir and Selenium
398
+ # * :id => Watir and Selenium
399
+ # * :index => Watir only
400
+ # * :name => Watir and Selenium
401
+ # * :text => Watir and Selenium
402
+ # * :xpath => Watir and Selenium
403
+ #
404
+ def cell_elements(identifier)
405
+ platform.cells_for(identifier.clone)
406
+ end
407
+
206
408
  #
207
409
  # Finds an image
208
410
  #
@@ -218,6 +420,21 @@ module PageObject
218
420
  platform.image_for(identifier.clone)
219
421
  end
220
422
 
423
+ #
424
+ # Finds all images that match the provided identifier
425
+ #
426
+ # @param [Hash] identifier how we find an image. You can use a multiple paramaters
427
+ # by combining of any of the following except xpath. The valid keys are:
428
+ # * :class => Watir and Selenium
429
+ # * :id => Watir and Selenium
430
+ # * :index => Watir and Selenium
431
+ # * :name => Watir and Selenium
432
+ # * :xpath => Watir and Selenium
433
+ #
434
+ def image_elements(identifier)
435
+ platform.images_for(identifier.clone)
436
+ end
437
+
221
438
  #
222
439
  # Finds a form
223
440
  #
@@ -232,6 +449,20 @@ module PageObject
232
449
  platform.form_for(identifier.clone)
233
450
  end
234
451
 
452
+ #
453
+ # Finds all forms that match the provided identifier
454
+ #
455
+ # @param [Hash] identifier how we find a form. You can use a multiple paramaters
456
+ # by combining of any of the following except xpath. The valid keys are:
457
+ # * :class => Watir and Selenium
458
+ # * :id => Watir and Selenium
459
+ # * :index => Watir and Selenium
460
+ # * :xpath => Watir and Selenium
461
+ #
462
+ def form_elements(identifier)
463
+ platform.forms_for(identifier.clone)
464
+ end
465
+
235
466
  #
236
467
  # Finds a list item
237
468
  #
@@ -247,6 +478,21 @@ module PageObject
247
478
  platform.list_item_for(identifier.clone)
248
479
  end
249
480
 
481
+ #
482
+ # Finds all list items that match the identifier
483
+ #
484
+ # @param [Hash] identifier how we find a list item. You can use a multiple paramaters
485
+ # by combining of any of the following except xpath. The valid keys are:
486
+ # * :class => Watir and Selenium
487
+ # * :id => Watir and Selenium
488
+ # * :index => Watir and Selenium
489
+ # * :name => Watir and Selenium
490
+ # * :xpath => Watir and Selenium
491
+ #
492
+ def list_item_elements(identifier)
493
+ platform.list_items_for(identifier.clone)
494
+ end
495
+
250
496
  #
251
497
  # Finds an unordered list
252
498
  #
@@ -262,6 +508,21 @@ module PageObject
262
508
  platform.unordered_list_for(identifier.clone)
263
509
  end
264
510
 
511
+ #
512
+ # Finds all unordered lists that match the identifier
513
+ #
514
+ # @param [Hash] identifier how we find an unordered list. You can use a multiple paramaters
515
+ # by combining of any of the following except xpath. The valid keys are:
516
+ # * :class => Watir and Selenium
517
+ # * :id => Watir and Selenium
518
+ # * :index => Watir and Selenium
519
+ # * :name => Watir and Selenium
520
+ # * :xpath => Watir and Selenium
521
+ #
522
+ def unordered_list_elements(identifier)
523
+ platform.unordered_lists_for(identifier.clone)
524
+ end
525
+
265
526
  #
266
527
  # Finds an ordered list
267
528
  #
@@ -277,6 +538,21 @@ module PageObject
277
538
  platform.ordered_list_for(identifier.clone)
278
539
  end
279
540
 
541
+ #
542
+ # Finds all ordered lists that match the identifier
543
+ #
544
+ # @param [Hash] identifier how we find an ordered list. You can use a multiple paramaters
545
+ # by combining of any of the following except xpath. The valid keys are:
546
+ # * :class => Watir and Selenium
547
+ # * :id => Watir and Selenium
548
+ # * :index => Watir and Selenium
549
+ # * :name => Watir and Selenium
550
+ # * :xpath => Watir and Selenium
551
+ #
552
+ def ordered_list_elements(identifier)
553
+ platform.ordered_lists_for(identifier.clone)
554
+ end
555
+
280
556
  #
281
557
  # Finds a h1
282
558
  #
@@ -292,6 +568,21 @@ module PageObject
292
568
  platform.h1_for(identifier.clone)
293
569
  end
294
570
 
571
+ #
572
+ # Finds all h1 elements matching the identifier
573
+ #
574
+ # @param [Hash] identifier how we find a H1. You can use a multiple paramaters
575
+ # by combining of any of the following except xpath. The valid keys are:
576
+ # * :class => Watir and Selenium
577
+ # * :id => Watir and Selenium
578
+ # * :index => Watir and Selenium
579
+ # * :name => Watir and Selenium
580
+ # * :xpath => Watir and Selenium
581
+ #
582
+ def h1_elements(identifier)
583
+ platform.h1s_for(identifier.clone)
584
+ end
585
+
295
586
  #
296
587
  # Finds a h2
297
588
  #
@@ -307,6 +598,21 @@ module PageObject
307
598
  platform.h2_for(identifier.clone)
308
599
  end
309
600
 
601
+ #
602
+ # Finds all h2 elements matching the identifier
603
+ #
604
+ # @param [Hash] identifier how we find a H2. You can use a multiple paramaters
605
+ # by combining of any of the following except xpath. The valid keys are:
606
+ # * :class => Watir and Selenium
607
+ # * :id => Watir and Selenium
608
+ # * :index => Watir and Selenium
609
+ # * :name => Watir and Selenium
610
+ # * :xpath => Watir and Selenium
611
+ #
612
+ def h2_elements(identifier)
613
+ platform.h2s_for(identifier.clone)
614
+ end
615
+
310
616
  #
311
617
  # Finds a h3
312
618
  #
@@ -322,6 +628,21 @@ module PageObject
322
628
  platform.h3_for(identifier.clone)
323
629
  end
324
630
 
631
+ #
632
+ # Finds all h3 elements for the identifier
633
+ #
634
+ # @param [Hash] identifier how we find a H3. You can use a multiple paramaters
635
+ # by combining of any of the following except xpath. The valid keys are:
636
+ # * :class => Watir and Selenium
637
+ # * :id => Watir and Selenium
638
+ # * :index => Watir and Selenium
639
+ # * :name => Watir and Selenium
640
+ # * :xpath => Watir and Selenium
641
+ #
642
+ def h3_elements(identifier)
643
+ platform.h3s_for(identifier.clone)
644
+ end
645
+
325
646
  #
326
647
  # Finds a h4
327
648
  #
@@ -337,6 +658,21 @@ module PageObject
337
658
  platform.h4_for(identifier.clone)
338
659
  end
339
660
 
661
+ #
662
+ # Finds all h4 elements matching the identifier
663
+ #
664
+ # @param [Hash] identifier how we find a H4. You can use a multiple paramaters
665
+ # by combining of any of the following except xpath. The valid keys are:
666
+ # * :class => Watir and Selenium
667
+ # * :id => Watir and Selenium
668
+ # * :index => Watir and Selenium
669
+ # * :name => Watir and Selenium
670
+ # * :xpath => Watir and Selenium
671
+ #
672
+ def h4_elements(identifier)
673
+ platform.h4s_for(identifier.clone)
674
+ end
675
+
340
676
  #
341
677
  # Finds a h5
342
678
  #
@@ -352,6 +688,21 @@ module PageObject
352
688
  platform.h5_for(identifier.clone)
353
689
  end
354
690
 
691
+ #
692
+ # Finds all h5 elements for the identifier
693
+ #
694
+ # @param [Hash] identifier how we find a H5. You can use a multiple paramaters
695
+ # by combining of any of the following except xpath. 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 h5_elements(identifier)
703
+ platform.h5s_for(identifier.clone)
704
+ end
705
+
355
706
  #
356
707
  # Finds a h6
357
708
  #
@@ -367,6 +718,21 @@ module PageObject
367
718
  platform.h6_for(identifier.clone)
368
719
  end
369
720
 
721
+ #
722
+ # Finds all h6 elements matching the identifier
723
+ #
724
+ # @param [Hash] identifier how we find a H6. You can use a multiple paramaters
725
+ # by combining of any of the following except xpath. The valid keys are:
726
+ # * :class => Watir and Selenium
727
+ # * :id => Watir and Selenium
728
+ # * :index => Watir and Selenium
729
+ # * :name => Watir and Selenium
730
+ # * :xpath => Watir and Selenium
731
+ #
732
+ def h6_elements(identifier)
733
+ platform.h6s_for(identifier.clone)
734
+ end
735
+
370
736
  #
371
737
  # Finds a paragraph
372
738
  #
@@ -382,7 +748,22 @@ module PageObject
382
748
  platform.paragraph_for(identifier.clone)
383
749
  end
384
750
 
385
- #
751
+ #
752
+ # Finds all paragraph elements
753
+ #
754
+ # @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters
755
+ # by combining of any of the following except xpath. The valid keys are:
756
+ # * :class => Watir and Selenium
757
+ # * :id => Watir and Selenium
758
+ # * :index => Watir and Selenium
759
+ # * :name => Watir and Selenium
760
+ # * :xpath => Watir and Selenium
761
+ #
762
+ def paragraph_elements(identifier)
763
+ platform.paragraphs_for(identifier.clone)
764
+ end
765
+
766
+ #
386
767
  # Finds a paragraph
387
768
  #
388
769
  # @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters