druid-ts 1.1.6 → 1.1.7

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