page-object 2.0.0 → 2.1

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/ChangeLog +10 -0
  4. data/README.md +12 -0
  5. data/Rakefile +2 -12
  6. data/cucumber.yml +2 -4
  7. data/lib/page-object.rb +12 -20
  8. data/lib/page-object/accessors.rb +50 -363
  9. data/lib/page-object/elements/bold.rb +0 -1
  10. data/lib/page-object/elements/button.rb +0 -4
  11. data/lib/page-object/elements/check_box.rb +19 -7
  12. data/lib/page-object/elements/div.rb +0 -4
  13. data/lib/page-object/elements/element.rb +159 -90
  14. data/lib/page-object/elements/file_field.rb +5 -7
  15. data/lib/page-object/elements/form.rb +0 -8
  16. data/lib/page-object/elements/hidden_field.rb +1 -4
  17. data/lib/page-object/elements/image.rb +13 -7
  18. data/lib/page-object/elements/label.rb +0 -4
  19. data/lib/page-object/elements/link.rb +0 -13
  20. data/lib/page-object/elements/list_item.rb +0 -3
  21. data/lib/page-object/elements/ordered_list.rb +30 -5
  22. data/lib/page-object/elements/radio_button.rb +12 -7
  23. data/lib/page-object/elements/select_list.rb +40 -8
  24. data/lib/page-object/elements/span.rb +0 -3
  25. data/lib/page-object/elements/table.rb +26 -5
  26. data/lib/page-object/elements/table_cell.rb +0 -4
  27. data/lib/page-object/elements/table_row.rb +30 -5
  28. data/lib/page-object/elements/text_area.rb +7 -7
  29. data/lib/page-object/elements/text_field.rb +5 -11
  30. data/lib/page-object/elements/unordered_list.rb +30 -5
  31. data/lib/page-object/indexed_properties.rb +1 -0
  32. data/lib/page-object/platforms.rb +0 -1
  33. data/lib/page-object/platforms/watir.rb +26 -4
  34. data/lib/page-object/platforms/watir/page_object.rb +4 -4
  35. data/lib/page-object/version.rb +1 -1
  36. data/lib/page-object/widgets.rb +0 -1
  37. data/page-object.gemspec +1 -15
  38. metadata +5 -47
  39. data/lib/page-object/platforms/selenium_webdriver.rb +0 -30
  40. data/lib/page-object/platforms/selenium_webdriver/button.rb +0 -15
  41. data/lib/page-object/platforms/selenium_webdriver/check_box.rb +0 -29
  42. data/lib/page-object/platforms/selenium_webdriver/element.rb +0 -335
  43. data/lib/page-object/platforms/selenium_webdriver/file_field.rb +0 -16
  44. data/lib/page-object/platforms/selenium_webdriver/form.rb +0 -16
  45. data/lib/page-object/platforms/selenium_webdriver/image.rb +0 -28
  46. data/lib/page-object/platforms/selenium_webdriver/link.rb +0 -23
  47. data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +0 -41
  48. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +0 -1297
  49. data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +0 -22
  50. data/lib/page-object/platforms/selenium_webdriver/select_list.rb +0 -93
  51. data/lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb +0 -42
  52. data/lib/page-object/platforms/selenium_webdriver/table.rb +0 -42
  53. data/lib/page-object/platforms/selenium_webdriver/table_row.rb +0 -43
  54. data/lib/page-object/platforms/selenium_webdriver/text_area.rb +0 -17
  55. data/lib/page-object/platforms/selenium_webdriver/text_field.rb +0 -17
  56. data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +0 -37
  57. data/lib/page-object/platforms/watir/check_box.rb +0 -29
  58. data/lib/page-object/platforms/watir/element.rb +0 -295
  59. data/lib/page-object/platforms/watir/file_field.rb +0 -16
  60. data/lib/page-object/platforms/watir/form.rb +0 -16
  61. data/lib/page-object/platforms/watir/image.rb +0 -22
  62. data/lib/page-object/platforms/watir/link.rb +0 -15
  63. data/lib/page-object/platforms/watir/ordered_list.rb +0 -40
  64. data/lib/page-object/platforms/watir/radio_button.rb +0 -22
  65. data/lib/page-object/platforms/watir/select_list.rb +0 -74
  66. data/lib/page-object/platforms/watir/table.rb +0 -38
  67. data/lib/page-object/platforms/watir/table_row.rb +0 -37
  68. data/lib/page-object/platforms/watir/text_area.rb +0 -23
  69. data/lib/page-object/platforms/watir/text_field.rb +0 -16
  70. data/lib/page-object/platforms/watir/unordered_list.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd4df22c84861242c7966223ea92954fadee7da8
4
- data.tar.gz: 02756b9b394d920567793cf474ed2c175428c79b
3
+ metadata.gz: 4a027ac9f94936e64f53e55c46687f9628df6cd6
4
+ data.tar.gz: 1b76a2f6e4f559bb9ba2b9e458f6672e3f0bd553
5
5
  SHA512:
6
- metadata.gz: 8d067360ea72b18ba508339efb5504d631b31fb55ef8a67d0cdb582b627fb57196d5818cd76fae440094d00ecd0ca1f19e1a426581ecdd887d7965d9ed6f89b4
7
- data.tar.gz: 87c90ae9d1602f49c4cc203a5b1f2e4b1699412383f244deee88cdf1a94f4a07077f668459ee4ac2c34448e8ef72d9671aa06d96ddfc1baf68aecaa6136bc3fd
6
+ metadata.gz: cdd0a78f1534741dc43e37c68448f2f2d1030c5e468842bd0086fc1f57a7fb95c372617601a2ee50bbf4bb16bca1b66dd1a78bf66f736478da76327890b3c766
7
+ data.tar.gz: c51cc96e81da1c2b0ee8b2584678bbee80195326690360fd7f7c63e36bd47f7b95dc7439bc7955d76d597ebc3de3148a9151cbb498a81409e3b5149370319e54
@@ -21,5 +21,4 @@ before_script:
21
21
  script: bundle exec rake $RAKE_TASK
22
22
  env:
23
23
  - RAKE_TASK=spec
24
- - RAKE_TASK=features:watir WATIR_BRANCH=master
25
- - RAKE_TASK=features:selenium
24
+ - RAKE_TASK=features
data/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ Version 2.1 / 2017-3-6
2
+ This is the first of three quick releases that will undo a lot of
3
+ legacy code and end with a far more flexible gem.
4
+ * Enhancements
5
+ * Removed Selenium Platform.
6
+ Still support Selenium driver by wrapping it with a Watir browser.
7
+ * Added ability to locate indexed element by regex (Thanks Sean MacGahan)
8
+ * Removed all direct delegates. Now relies on method_missing to call Watir methods.
9
+ - You may have to change RSpec matchers to use method instead of predicate.
10
+
1
11
  Version 2.0.0 / 2016-11-22
2
12
  * Enhancements
3
13
  * Added focused? method on element. (Thanks Joe Schulte)
data/README.md CHANGED
@@ -94,6 +94,18 @@ browser = Selenium::WebDriver.for :firefox
94
94
  my_page_object = MyPageObject.new(browser)
95
95
  ````
96
96
 
97
+ ## Notes
98
+
99
+ ### Cucumber usage:
100
+
101
+ Specify you javasctipt notes:
102
+ ```ruby
103
+ AfterConfiguration do |config|
104
+ PageObject::JavascriptFrameworkFacade.framework=:jquery
105
+ end
106
+
107
+ ```
108
+
97
109
  ## Known Issues
98
110
 
99
111
  See [http://github.com/cheezy/page-object/issues](http://github.com/cheezy/page-object/issues)
data/Rakefile CHANGED
@@ -14,21 +14,11 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
14
14
  end
15
15
  task :spec
16
16
 
17
- namespace :features do
18
- Cucumber::Rake::Task.new(:watir, "Run features with Watir") do |t|
19
- t.profile = "watir"
20
- end
17
+ Cucumber::Rake::Task.new(:features, "Run the cucumber features")
21
18
 
22
- Cucumber::Rake::Task.new(:selenium, "Run features with Selenium") do |t|
23
- t.profile = "selenium_webdriver"
24
- end
25
-
26
- desc 'Run all features'
27
- task :all => [:watir, :selenium]
28
- end
29
19
 
30
20
  desc 'Run all specs and cukes'
31
- task :test => ['spec', 'features:all']
21
+ task :test => ['spec', 'features']
32
22
 
33
23
  task :lib do
34
24
  $LOAD_PATH.unshift(File.expand_path("lib", File.dirname(__FILE__)))
@@ -2,9 +2,7 @@
2
2
  std_opts = "--no-source --color --format pretty" # Cucumber::Formatter::Fuubar"
3
3
  %>
4
4
 
5
- default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
6
- watir: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
7
- selenium_webdriver: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
5
+ default: DRIVER=WATIR <%= std_opts %>
6
+ selenium: DRIVER=SELENIUM <%= std_opts %>
8
7
  focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
9
- #focus: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus
10
8
 
@@ -11,12 +11,8 @@ require 'page-object/section_collection'
11
11
  require 'page-object/widgets'
12
12
 
13
13
  require 'watir'
14
- require 'page-object/platforms/watir/element'
15
14
  require 'page-object/platforms/watir/page_object'
16
- require 'page-object/platforms/selenium_webdriver/element'
17
- require 'page-object/platforms/selenium_webdriver/page_object'
18
15
 
19
- require 'selenium/webdriver/common/error'
20
16
  #
21
17
  # Module that when included adds functionality to a page object. This module
22
18
  # will add numerous class and instance methods that you use to define and
@@ -51,20 +47,16 @@ module PageObject
51
47
  include PagePopulator
52
48
 
53
49
  def method_missing(method, *args, &block)
54
- if @root_element && @root_element.respond_to?(method)
55
- @root_element.send(method, *args, &block)
56
- else
57
- super
58
- end
50
+ @root_element.send(method, *args, &block)
59
51
  end
60
52
 
61
53
  def respond_to_missing?(method, include_all = false)
62
54
  @root_element && @root_element.respond_to?(method) || super
63
55
  end
64
56
 
65
- # @return [Watir::Browser or Selenium::WebDriver::Driver] the platform browser passed to the constructor
57
+ # @return the platform browser passed to the constructor
66
58
  attr_reader :browser
67
- # @return [PageObject::WatirPageObject or PageObject::SeleniumPageObject] the platform page object
59
+ # @return [PageObject::WatirPageObject] the platform page object
68
60
  attr_reader :platform
69
61
 
70
62
  #
@@ -164,7 +156,7 @@ module PageObject
164
156
  # Returns the text of the current page
165
157
  #
166
158
  def text
167
- root.text
159
+ platform.text
168
160
  end
169
161
 
170
162
  #
@@ -291,10 +283,10 @@ module PageObject
291
283
  # end
292
284
  #
293
285
  # @param [Hash] identifier how we find the frame. The valid keys are:
294
- # * :id => Watir and Selenium
295
- # * :index => Watir and Selenium
296
- # * :name => Watir and Selenium
297
- # * :class => Watir only
286
+ # * :id
287
+ # * :index
288
+ # * :name
289
+ # * :class
298
290
  # @param frame passed from a previous call to in_frame. Used to nest calls
299
291
  # @param block that contains the calls to elements that exist inside the frame.
300
292
  #
@@ -312,10 +304,10 @@ module PageObject
312
304
  # end
313
305
  #
314
306
  # @param [Hash] identifier how we find the iframe. The valid keys are:
315
- # * :id => Watir and Selenium
316
- # * :index => Watir and Selenium
317
- # * :name => Watir and Selenium
318
- # * :class => Watir only
307
+ # * :id
308
+ # * :index
309
+ # * :name
310
+ # * :class
319
311
  # @param frame passed from a previous call to in_iframe. Used to nest calls
320
312
  # @param block that contains the calls to elements that exist inside the iframe.
321
313
  #
@@ -7,9 +7,6 @@ module PageObject
7
7
  # when you include the PageObject module. These methods will generate another
8
8
  # set of methods that provide access to the elements on the web pages.
9
9
  #
10
- # @see PageObject::WatirPageObject for the watir implementation of the platform delegate
11
- # @see PageObject::SeleniumPageObject for the selenium implementation of the platform delegate
12
- #
13
10
  module Accessors
14
11
 
15
12
  #
@@ -145,10 +142,10 @@ module PageObject
145
142
  # end
146
143
  #
147
144
  # @param [Hash] identifier how we find the frame. The valid keys are:
148
- # * :id => Watir and Selenium
149
- # * :index => Watir and Selenium
150
- # * :name => Watir and Selenium
151
- # * :regexp => Watir only
145
+ # * :id
146
+ # * :index
147
+ # * :name
148
+ # * :regexp
152
149
  # @param frame passed from a previous call to in_frame. Used to nest calls
153
150
  # @param block that contains the calls to elements that exist inside the frame.
154
151
  #
@@ -169,10 +166,10 @@ module PageObject
169
166
  # end
170
167
  #
171
168
  # @param [Hash] identifier how we find the frame. The valid keys are:
172
- # * :id => Watir and Selenium
173
- # * :index => Watir and Selenium
174
- # * :name => Watir and Selenium
175
- # * :regexp => Watir only
169
+ # * :id
170
+ # * :index
171
+ # * :name
172
+ # * :regexp
176
173
  # @param frame passed from a previous call to in_iframe. Used to nest calls
177
174
  # @param block that contains the calls to elements that exist inside the iframe.
178
175
  #
@@ -193,18 +190,7 @@ module PageObject
193
190
  # # 'first_name?' methods
194
191
  #
195
192
  # @param [String] the name used for the generated methods
196
- # @param [Hash] identifier how we find a text field. You can use a multiple parameters
197
- # by combining of any of the following except xpath. The valid keys are:
198
- # * :class => Watir and Selenium
199
- # * :css => Watir and Selenium
200
- # * :id => Watir and Selenium
201
- # * :index => Watir and Selenium
202
- # * :label => Watir and Selenium
203
- # * :name => Watir and Selenium
204
- # * :text => Watir and Selenium
205
- # * :title => Watir and Selenium
206
- # * :value => Watir only
207
- # * :xpath => Watir and Selenium
193
+ # @param [Hash] identifier how we find a text field.
208
194
  # @param optional block to be invoked when element method is called
209
195
  #
210
196
  def text_field(name, identifier={:index => 0}, &block)
@@ -229,16 +215,7 @@ module PageObject
229
215
  # # will generate 'user_id', 'user_id_element' and 'user_id?' methods
230
216
  #
231
217
  # @param [String] the name used for the generated methods
232
- # @param [Hash] identifier how we find a hidden field. You can use a multiple parameters
233
- # by combining of any of the following except xpath. The valid keys are:
234
- # * :class => Watir and Selenium
235
- # * :css => Watir and Selenium
236
- # * :id => Watir and Selenium
237
- # * :index => Watir and Selenium
238
- # * :name => Watir and Selenium
239
- # * :text => Watir and Selenium
240
- # * :value => Watir and Selenium
241
- # * :xpath => Watir and Selenium
218
+ # @param [Hash] identifier how we find a hidden field.
242
219
  # @param optional block to be invoked when element method is called
243
220
  #
244
221
  def hidden_field(name, identifier={:index => 0}, &block)
@@ -261,15 +238,7 @@ module PageObject
261
238
  # # 'address?' methods
262
239
  #
263
240
  # @param [String] the name used for the generated methods
264
- # @param [Hash] identifier how we find a text area. You can use a multiple parameters
265
- # by combining of any of the following except xpath. The valid keys are:
266
- # * :class => Watir and Selenium
267
- # * :css => Watir and Selenium
268
- # * :id => Watir and Selenium
269
- # * :index => Watir and Selenium
270
- # * :name => Watir and Selenium
271
- # * :xpath => Watir and Selenium
272
- # * :label => Watir and Selenium
241
+ # @param [Hash] identifier how we find a text area.
273
242
  # @param optional block to be invoked when element method is called
274
243
  #
275
244
  def text_area(name, identifier={:index => 0}, &block)
@@ -297,17 +266,7 @@ module PageObject
297
266
  # # will generate 'state', 'state=', 'state_element', 'state?', "state_options" methods
298
267
  #
299
268
  # @param [Symbol] the name used for the generated methods
300
- # @param [Hash] identifier how we find a select list. You can use a multiple parameters
301
- # by combining of any of the following except xpath. The valid keys are:
302
- # * :class => Watir and Selenium
303
- # * :css => Watir and Selenium
304
- # * :id => Watir and Selenium
305
- # * :index => Watir and Selenium
306
- # * :name => Watir and Selenium
307
- # * :text => Watir only
308
- # * :value => Watir only
309
- # * :xpath => Watir and Selenium
310
- # * :label => Watir and Selenium
269
+ # @param [Hash] identifier how we find a select list.
311
270
  # @param optional block to be invoked when element method is called
312
271
  #
313
272
  def select_list(name, identifier={:index => 0}, &block)
@@ -337,19 +296,7 @@ module PageObject
337
296
  # # will generate 'add_to_cart', 'add_to_cart_element', and 'add_to_cart?' methods
338
297
  #
339
298
  # @param [Symbol] the name used for the generated methods
340
- # @param [Hash] identifier how we find a link. You can use a multiple parameters
341
- # by combining of any of the following except xpath. The valid keys are:
342
- # * :class => Watir and Selenium
343
- # * :css => Watir and Selenium
344
- # * :href => Watir and Selenium
345
- # * :id => Watir and Selenium
346
- # * :index => Watir and Selenium
347
- # * :link => Watir and Selenium
348
- # * :link_text => Watir and Selenium
349
- # * :name => Watir and Selenium
350
- # * :text => Watir and Selenium
351
- # * :title => Watir and Selenium
352
- # * :xpath => Watir and Selenium
299
+ # @param [Hash] identifier how we find a link.
353
300
  # @param optional block to be invoked when element method is called
354
301
  #
355
302
  def link(name, identifier={:index => 0}, &block)
@@ -373,16 +320,7 @@ module PageObject
373
320
  # # 'active_element', and 'active?' methods
374
321
  #
375
322
  # @param [Symbol] the name used for the generated methods
376
- # @param [Hash] identifier how we find a checkbox. You can use a multiple parameters
377
- # by combining of any of the following except xpath. The valid keys are:
378
- # * :class => Watir and Selenium
379
- # * :css => Watir and Selenium
380
- # * :id => Watir and Selenium
381
- # * :index => Watir and Selenium
382
- # * :name => Watir and Selenium
383
- # * :value => Watir and Selenium
384
- # * :xpath => Watir and Selenium
385
- # * :label => Watir and Selenium
323
+ # @param [Hash] identifier how we find a checkbox.
386
324
  # @param optional block to be invoked when element method is called
387
325
  #
388
326
  def checkbox(name, identifier={:index => 0}, &block)
@@ -413,16 +351,7 @@ module PageObject
413
351
  # # 'north_element', and 'north?' methods
414
352
  #
415
353
  # @param [Symbol] the name used for the generated methods
416
- # @param [Hash] identifier how we find a radio button. You can use a multiple parameters
417
- # by combining of any of the following except xpath. The valid keys are:
418
- # * :class => Watir and Selenium
419
- # * :css => Watir and Selenium
420
- # * :id => Watir and Selenium
421
- # * :index => Watir and Selenium
422
- # * :name => Watir and Selenium
423
- # * :value => Watir and Selenium
424
- # * :xpath => Watir and Selenium
425
- # * :label => Watir and Selenium
354
+ # @param [Hash] identifier how we find a radio button.
426
355
  # @param optional block to be invoked when element method is called
427
356
  #
428
357
  def radio_button(name, identifier={:index => 0}, &block)
@@ -456,7 +385,7 @@ module PageObject
456
385
  # @param [Symbol] the name used for the generated methods
457
386
  # @param [Hash] shared identifier for the radio button group. Typically, a 'name' attribute.
458
387
  # The valid keys are:
459
- # * :name => Watir and Selenium
388
+ # * :name
460
389
  #
461
390
  def radio_button_group(name, identifier)
462
391
  define_method("select_#{name}") do |value|
@@ -497,18 +426,7 @@ module PageObject
497
426
  # # will generate 'purchase', 'purchase_element', and 'purchase?' methods
498
427
  #
499
428
  # @param [Symbol] the name used for the generated methods
500
- # @param [Hash] identifier how we find a button. You can use a multiple parameters
501
- # by combining of any of the following except xpath. The valid keys are:
502
- # * :class => Watir and Selenium
503
- # * :css => Watir and Selenium
504
- # * :id => Watir and Selenium
505
- # * :index => Watir and Selenium
506
- # * :name => Watir and Selenium
507
- # * :text => Watir only
508
- # * :value => Watir and Selenium
509
- # * :xpath => Watir and Selenium
510
- # * :src => Watir and Selenium (input type=image only)
511
- # * :alt => Watir and Selenium (input type=image only)
429
+ # @param [Hash] identifier how we find a button.
512
430
  # @param optional block to be invoked when element method is called
513
431
  #
514
432
  def button(name, identifier={:index => 0}, &block)
@@ -528,16 +446,7 @@ module PageObject
528
446
  # # will generate 'message', 'message_element', and 'message?' methods
529
447
  #
530
448
  # @param [Symbol] the name used for the generated methods
531
- # @param [Hash] identifier how we find a div. You can use a multiple parameters
532
- # by combining of any of the following except xpath. The valid keys are:
533
- # * :class => Watir and Selenium
534
- # * :css => Watir and Selenium
535
- # * :id => Watir and Selenium
536
- # * :index => Watir and Selenium
537
- # * :name => Watir and Selenium
538
- # * :text => Watir and Selenium
539
- # * :title => Watir and Selenium
540
- # * :xpath => Watir and Selenium
449
+ # @param [Hash] identifier how we find a div.
541
450
  # @param optional block to be invoked when element method is called
542
451
  #
543
452
  def div(name, identifier={:index => 0}, &block)
@@ -557,16 +466,7 @@ module PageObject
557
466
  # # will generate 'alert', 'alert_element', and 'alert?' methods
558
467
  #
559
468
  # @param [Symbol] the name used for the generated methods
560
- # @param [Hash] identifier how we find a span. You can use a multiple parameters
561
- # by combining of any of the following except xpath. The valid keys are:
562
- # * :class => Watir and Selenium
563
- # * :css => Watir and Selenium
564
- # * :id => Watir and Selenium
565
- # * :index => Watir and Selenium
566
- # * :name => Watir and Selenium
567
- # * :text => Watir and Selenium
568
- # * :title => Watir and Selenium
569
- # * :xpath => Watir and Selenium
469
+ # @param [Hash] identifier how we find a span.
570
470
  # @param optional block to be invoked when element method is called
571
471
  #
572
472
  def span(name, identifier={:index => 0}, &block)
@@ -580,22 +480,14 @@ module PageObject
580
480
  #
581
481
  # adds three methods - one to return the text for the table, one
582
482
  # to retrieve the table element, and another to
583
- # check the table's existence. The existence method does not work
584
- # on Selenium so it should not be called.
483
+ # check the table's existence.
585
484
  #
586
485
  # @example
587
486
  # table(:cart, :id => 'shopping_cart')
588
487
  # # will generate a 'cart', 'cart_element' and 'cart?' method
589
488
  #
590
489
  # @param [Symbol] the name used for the generated methods
591
- # @param [Hash] identifier how we find a table. You can use a multiple parameters
592
- # by combining of any of the following except xpath. The valid keys are:
593
- # * :class => Watir and Selenium
594
- # * :css => Watir and Selenium
595
- # * :id => Watir and Selenium
596
- # * :index => Watir and Selenium
597
- # * :name => Watir and Selenium
598
- # * :xpath => Watir and Selenium
490
+ # @param [Hash] identifier how we find a table.
599
491
  # @param optional block to be invoked when element method is called
600
492
  #
601
493
  def table(name, identifier={:index => 0}, &block)
@@ -616,16 +508,7 @@ module PageObject
616
508
  # # will generate 'total', 'total_element', and 'total?' methods
617
509
  #
618
510
  # @param [Symbol] the name used for the generated methods
619
- # @param [Hash] identifier how we find a cell. You can use a multiple parameters
620
- # by combining of any of the following except xpath. The valid keys are:
621
- # * :class => Watir and Selenium
622
- # * :css => Watir and Selenium
623
- # * :id => Watir and Selenium
624
- # * :index => Watir and Selenium
625
- # * :name => Watir and Selenium
626
- # * :text => Watir and Selenium
627
- # * :xpath => Watir and Selenium
628
- # * :css => Watir and Selenium
511
+ # @param [Hash] identifier how we find a cell.
629
512
  # @param optional block to be invoked when element method is called
630
513
  #
631
514
  def cell(name, identifier={:index => 0}, &block)
@@ -648,15 +531,7 @@ module PageObject
648
531
  # # will generate 'sums', 'sums_element', and 'sums?' methods
649
532
  #
650
533
  # @param [Symbol] the name used for the generated methods
651
- # @param [Hash] identifier how we find a cell. You can use a multiple parameters
652
- # by combining of any of the following except xpath. The valid keys are:
653
- # * :class => Watir and Selenium
654
- # * :css => Watir and Selenium
655
- # * :id => Watir and Selenium
656
- # * :index => Watir and Selenium
657
- # * :text => Watir only
658
- # * :xpath => Watir and Selenium
659
- # * :css => Watir and Selenium
534
+ # @param [Hash] identifier how we find a cell.
660
535
  # @param optional block to be invoked when element method is called
661
536
  #
662
537
  def row(name, identifier={:index => 0}, &block)
@@ -677,16 +552,7 @@ module PageObject
677
552
  # # will generate 'logo_element', 'logo_loaded?', and 'logo?' methods
678
553
  #
679
554
  # @param [Symbol] the name used for the generated methods
680
- # @param [Hash] identifier how we find an image. You can use a multiple parameters
681
- # by combining of any of the following except xpath. The valid keys are:
682
- # * :alt => Watir and Selenium
683
- # * :class => Watir and Selenium
684
- # * :css => Watir and Selenium
685
- # * :id => Watir and Selenium
686
- # * :index => Watir and Selenium
687
- # * :name => Watir and Selenium
688
- # * :src => Watir and Selenium
689
- # * :xpath => Watir and Selenium
555
+ # @param [Hash] identifier how we find an image.
690
556
  # @param optional block to be invoked when element method is called
691
557
  #
692
558
  def image(name, identifier={:index => 0}, &block)
@@ -707,14 +573,7 @@ module PageObject
707
573
  # # will generate 'login_element' and 'login?' methods
708
574
  #
709
575
  # @param [Symbol] the name used for the generated methods
710
- # @param [Hash] identifier how we find a form. You can use a multiple parameters
711
- # by combining of any of the following except xpath. The valid keys are:
712
- # * :action => Watir and Selenium
713
- # * :class => Watir and Selenium
714
- # * :css => Watir and Selenium
715
- # * :id => Watir and Selenium
716
- # * :index => Watir and Selenium
717
- # * :xpath => Watir and Selenium
576
+ # @param [Hash] identifier how we find a form.
718
577
  # @param optional block to be invoked when element method is called
719
578
  #
720
579
  def form(name, identifier={:index => 0}, &block)
@@ -731,15 +590,7 @@ module PageObject
731
590
  # # will generate 'item_one', 'item_one_element', and 'item_one?' methods
732
591
  #
733
592
  # @param [Symbol] the name used for the generated methods
734
- # @param [Hash] identifier how we find a list item. You can use a multiple parameters
735
- # by combining of any of the following except xpath. The valid keys are:
736
- # * :class => Watir and Selenium
737
- # * :css => Watir and Selenium
738
- # * :id => Watir and Selenium
739
- # * :index => Watir and Selenium
740
- # * :name => Watir and Selenium
741
- # * :text => Watir and Selenium
742
- # * :xpath => Watir and Selenium
593
+ # @param [Hash] identifier how we find a list item.
743
594
  # @param optional block to be invoked when element method is called
744
595
  #
745
596
  def list_item(name, identifier={:index => 0}, &block)
@@ -761,14 +612,7 @@ module PageObject
761
612
  # # will generate 'menu', 'menu_element' and 'menu?' methods
762
613
  #
763
614
  # @param [Symbol] the name used for the generated methods
764
- # @param [Hash] identifier how we find an unordered list. You can use a multiple parameters
765
- # by combining of any of the following except xpath. The valid keys are:
766
- # * :class => Watir and Selenium
767
- # * :css => Watir and Selenium
768
- # * :id => Watir and Selenium
769
- # * :index => Watir and Selenium
770
- # * :name => Watir and Selenium
771
- # * :xpath => Watir and Selenium
615
+ # @param [Hash] identifier how we find an unordered list.
772
616
  # @param optional block to be invoked when element method is called
773
617
  #
774
618
  def unordered_list(name, identifier={:index => 0}, &block)
@@ -790,14 +634,7 @@ module PageObject
790
634
  # # will generate 'top_five', 'top_five_element' and 'top_five?' methods
791
635
  #
792
636
  # @param [Symbol] the name used for the generated methods
793
- # @param [Hash] identifier how we find an ordered list. You can use a multiple parameters
794
- # by combining of any of the following except xpath. The valid keys are:
795
- # * :class => Watir and Selenium
796
- # * :css => Watir and Selenium
797
- # * :id => Watir and Selenium
798
- # * :index => Watir and Selenium
799
- # * :name => Watir and Selenium
800
- # * :xpath => Watir and Selenium
637
+ # @param [Hash] identifier how we find an ordered list.
801
638
  # @param optional block to be invoked when element method is called
802
639
  #
803
640
  def ordered_list(name, identifier={:index => 0}, &block)
@@ -819,13 +656,7 @@ module PageObject
819
656
  #
820
657
  # @param [Symbol] the name used for the generated methods
821
658
  # @param [Hash] identifier how we find a H1. You can use a multiple parameters
822
- # by combining of any of the following except xpath. The valid keys are:
823
- # * :class => Watir and Selenium
824
- # * :css => Watir and Selenium
825
- # * :id => Watir and Selenium
826
- # * :index => Watir and Selenium
827
- # * :name => Watir and Selenium
828
- # * :xpath => Watir and Selenium
659
+ # by combining of any of the following except xpath.
829
660
  # @param optional block to be invoked when element method is called
830
661
  #
831
662
  def h1(name, identifier={:index => 0}, &block)
@@ -845,14 +676,7 @@ module PageObject
845
676
  # # will generate 'title', 'title_element', and 'title?' methods
846
677
  #
847
678
  # @param [Symbol] the name used for the generated methods
848
- # @param [Hash] identifier how we find a H2. You can use a multiple parameters
849
- # by combining of any of the following except xpath. The valid keys are:
850
- # * :class => Watir and Selenium
851
- # * :css => Watir and Selenium
852
- # * :id => Watir and Selenium
853
- # * :index => Watir and Selenium
854
- # * :name => Watir and Selenium
855
- # * :xpath => Watir and Selenium
679
+ # @param [Hash] identifier how we find a H2.
856
680
  # @param optional block to be invoked when element method is called
857
681
  #
858
682
  def h2(name, identifier={:index => 0}, &block)
@@ -872,14 +696,7 @@ module PageObject
872
696
  # # will generate 'title', 'title_element', and 'title?' methods
873
697
  #
874
698
  # @param [Symbol] the name used for the generated methods
875
- # @param [Hash] identifier how we find a H3. You can use a multiple parameters
876
- # by combining of any of the following except xpath. The valid keys are:
877
- # * :class => Watir and Selenium
878
- # * :css => Watir and Selenium
879
- # * :id => Watir and Selenium
880
- # * :index => Watir and Selenium
881
- # * :name => Watir and Selenium
882
- # * :xpath => Watir and Selenium
699
+ # @param [Hash] identifier how we find a H3.
883
700
  # @param optional block to be invoked when element method is called
884
701
  #
885
702
  def h3(name, identifier={:index => 0}, &block)
@@ -899,14 +716,7 @@ module PageObject
899
716
  # # will generate 'title', 'title_element', and 'title?' methods
900
717
  #
901
718
  # @param [Symbol] the name used for the generated methods
902
- # @param [Hash] identifier how we find a H4. You can use a multiple parameters
903
- # by combining of any of the following except xpath. The valid keys are:
904
- # * :class => Watir and Selenium
905
- # * :css => Watir and Selenium
906
- # * :id => Watir and Selenium
907
- # * :index => Watir and Selenium
908
- # * :name => Watir and Selenium
909
- # * :xpath => Watir and Selenium
719
+ # @param [Hash] identifier how we find a H4.
910
720
  # @param optional block to be invoked when element method is called
911
721
  #
912
722
  def h4(name, identifier={:index => 0}, &block)
@@ -926,14 +736,7 @@ module PageObject
926
736
  # # will generate 'title', 'title_element', and 'title?' methods
927
737
  #
928
738
  # @param [Symbol] the name used for the generated methods
929
- # @param [Hash] identifier how we find a H5. You can use a multiple parameters
930
- # by combining of any of the following except xpath. The valid keys are:
931
- # * :class => Watir and Selenium
932
- # * :css => Watir and Selenium
933
- # * :id => Watir and Selenium
934
- # * :index => Watir and Selenium
935
- # * :name => Watir and Selenium
936
- # * :xpath => Watir and Selenium
739
+ # @param [Hash] identifier how we find a H5.
937
740
  # @param optional block to be invoked when element method is called
938
741
  #
939
742
  def h5(name, identifier={:index => 0}, &block)
@@ -953,14 +756,7 @@ module PageObject
953
756
  # # will generate 'title', 'title_element', and 'title?' methods
954
757
  #
955
758
  # @param [Symbol] the name used for the generated methods
956
- # @param [Hash] identifier how we find a H6. You can use a multiple parameters
957
- # by combining of any of the following except xpath. The valid keys are:
958
- # * :class => Watir and Selenium
959
- # * :css => Watir and Selenium
960
- # * :id => Watir and Selenium
961
- # * :index => Watir and Selenium
962
- # * :name => Watir and Selenium
963
- # * :xpath => Watir and Selenium
759
+ # @param [Hash] identifier how we find a H6.
964
760
  # @param optional block to be invoked when element method is called
965
761
  #
966
762
  def h6(name, identifier={:index => 0}, &block)
@@ -980,14 +776,7 @@ module PageObject
980
776
  # # will generate 'title', 'title_element', and 'title?' methods
981
777
  #
982
778
  # @param [Symbol] the name used for the generated methods
983
- # @param [Hash] identifier how we find a paragraph. You can use a multiple parameters
984
- # by combining of any of the following except xpath. The valid keys are:
985
- # * :class => Watir and Selenium
986
- # * :css => Watir and Selenium
987
- # * :id => Watir and Selenium
988
- # * :index => Watir and Selenium
989
- # * :name => Watir and Selenium
990
- # * :xpath => Watir and Selenium
779
+ # @param [Hash] identifier how we find a paragraph.
991
780
  # @param optional block to be invoked when element method is called
992
781
  #
993
782
  def paragraph(name, identifier={:index => 0}, &block)
@@ -1008,16 +797,7 @@ module PageObject
1008
797
  # # will generate 'the_file=', 'the_file_element', and 'the_file?' methods
1009
798
  #
1010
799
  # @param [Symbol] the name used for the generated methods
1011
- # @param [Hash] identifier how we find a file_field. You can use a multiple parameters
1012
- # by combining of any of the following except xpath. The valid keys are:
1013
- # * :class => Watir and Selenium
1014
- # * :css => Watir and Selenium
1015
- # * :id => Watir and Selenium
1016
- # * :index => Watir and Selenium
1017
- # * :name => Watir and Selenium
1018
- # * :title => Watir and Selenium
1019
- # * :xpath => Watir and Selenium
1020
- # * :label => Watir and Selenium
800
+ # @param [Hash] identifier how we find a file_field.
1021
801
  # @param optional block to be invoked when element method is called
1022
802
  #
1023
803
  def file_field(name, identifier={:index => 0}, &block)
@@ -1037,15 +817,7 @@ module PageObject
1037
817
  # # will generate 'message', 'message_element', and 'message?' methods
1038
818
  #
1039
819
  # @param [Symbol] the name used for the generated methods
1040
- # @param [Hash] identifier how we find a label. You can use a multiple parameters
1041
- # by combining of any of the following except xpath. The valid keys are:
1042
- # * :class => Watir and Selenium
1043
- # * :css => Watir and Selenium
1044
- # * :id => Watir and Selenium
1045
- # * :index => Watir and Selenium
1046
- # * :name => Watir and Selenium
1047
- # * :text => Watir and Selenium
1048
- # * :xpath => Watir and Selenium
820
+ # @param [Hash] identifier how we find a label.
1049
821
  # @param optional block to be invoked when element method is called
1050
822
  #
1051
823
  def label(name, identifier={:index => 0}, &block)
@@ -1065,15 +837,7 @@ module PageObject
1065
837
  # # will generate 'message', 'message_element', and 'message?' methods
1066
838
  #
1067
839
  # @param [Symbol] the name used for the generated methods
1068
- # @param [Hash] identifier how we find an area. You can use a multiple parameters
1069
- # by combining of any of the following except xpath. The valid keys are:
1070
- # * :class => Watir and Selenium
1071
- # * :css => Watir and Selenium
1072
- # * :id => Watir and Selenium
1073
- # * :index => Watir and Selenium
1074
- # * :name => Watir and Selenium
1075
- # * :text => Watir and Selenium
1076
- # * :xpath => Watir and Selenium
840
+ # @param [Hash] identifier how we find an area.
1077
841
  # @param optional block to be invoked when element method is called
1078
842
  #
1079
843
  def area(name, identifier={:index => 0}, &block)
@@ -1093,14 +857,7 @@ module PageObject
1093
857
  # # will generate 'my_canvas_element' and 'my_canvas?' methods
1094
858
  #
1095
859
  # @param [Symbol] the name used for the generated methods
1096
- # @param [Hash] identifier how we find a canvas. You can use a multiple parameters
1097
- # by combining of any of the following except xpath. The valid keys are:
1098
- # * :class => Watir and Selenium
1099
- # * :css => Watir and Selenium
1100
- # * :id => Watir and Selenium
1101
- # * :index => Watir and Selenium
1102
- # * :name => Watir and Selenium
1103
- # * :xpath => Watir and Selenium
860
+ # @param [Hash] identifier how we find a canvas.
1104
861
  # @param optional block to be invoked when element method is called
1105
862
  #
1106
863
  def canvas(name, identifier={:index => 0}, &block)
@@ -1116,14 +873,7 @@ module PageObject
1116
873
  # # will generate 'acdc_element' and 'acdc?' methods
1117
874
  #
1118
875
  # @param [Symbol] the name used for the generated methods
1119
- # @param [Hash] identifier how we find an audio element. You can use a multiple parameters
1120
- # by combining of any of the following except xpath. The valid keys are:
1121
- # * :class => Watir and Selenium
1122
- # * :css => Watir and Selenium
1123
- # * :id => Watir and Selenium
1124
- # * :index => Watir and Selenium
1125
- # * :name => Watir and Selenium
1126
- # * :xpath => Watir and Selenium
876
+ # @param [Hash] identifier how we find an audio element.
1127
877
  # @param optional block to be invoked when element method is called
1128
878
  #
1129
879
  def audio(name, identifier={:index => 0}, &block)
@@ -1139,14 +889,7 @@ module PageObject
1139
889
  # # will generate 'movie_element' and 'movie?' methods
1140
890
  #
1141
891
  # @param [Symbol] the name used for the generated methods
1142
- # @param [Hash] identifier how we find a video element. You can use a multiple parameters
1143
- # by combining of any of the following except xpath. The valid keys are:
1144
- # * :class => Watir and Selenium
1145
- # * :css => Watir and Selenium
1146
- # * :id => Watir and Selenium
1147
- # * :index => Watir and Selenium
1148
- # * :name => Watir and Selenium
1149
- # * :xpath => Watir and Selenium
892
+ # @param [Hash] identifier how we find a video element.
1150
893
  # @param optional block to be invoked when element method is called
1151
894
  #
1152
895
  def video(name, identifier={:index => 0}, &block)
@@ -1162,14 +905,7 @@ module PageObject
1162
905
  # # will generate 'bold', 'bold_element', and 'bold?' methods
1163
906
  #
1164
907
  # @param [Symbol] the name used for the generated methods
1165
- # @param [Hash] identifier how we find a b. You can use a multiple parameters
1166
- # by combining of any of the following except xpath. The valid keys are:
1167
- # * :class => Watir and Selenium
1168
- # * :css => Watir and Selenium
1169
- # * :id => Watir and Selenium
1170
- # * :index => Watir and Selenium
1171
- # * :name => Watir and Selenium
1172
- # * :xpath => Watir and Selenium
908
+ # @param [Hash] identifier how we find a b.
1173
909
  # @param optional block to be invoked when element method is called
1174
910
  #
1175
911
  def b(name, identifier={:index => 0}, &block)
@@ -1189,14 +925,7 @@ module PageObject
1189
925
  # # will generate 'italic', 'italic_element', and 'italic?' methods
1190
926
  #
1191
927
  # @param [Symbol] the name used for the generated methods
1192
- # @param [Hash] identifier how we find a i. You can use a multiple parameters
1193
- # by combining of any of the following except xpath. The valid keys are:
1194
- # * :class => Watir and Selenium
1195
- # * :css => Watir and Selenium
1196
- # * :id => Watir and Selenium
1197
- # * :index => Watir and Selenium
1198
- # * :name => Watir and Selenium
1199
- # * :xpath => Watir and Selenium
928
+ # @param [Hash] identifier how we find a i.
1200
929
  # @param optional block to be invoked when element method is called
1201
930
  #
1202
931
  def i(name, identifier={:index => 0}, &block)
@@ -1217,14 +946,7 @@ module PageObject
1217
946
  # # will generate 'circle_element', and 'circle?' methods
1218
947
  #
1219
948
  # @param [Symbol] the name used for the generated methods
1220
- # @param [Hash] identifier how we find a svg. You can use a multiple parameters
1221
- # by combining of any of the following except xpath. The valid keys are:
1222
- # * :class => Watir and Selenium
1223
- # * :css => Watir and Selenium
1224
- # * :id => Watir and Selenium
1225
- # * :index => Watir and Selenium
1226
- # * :name => Watir and Selenium
1227
- # * :xpath => Watir and Selenium
949
+ # @param [Hash] identifier how we find a svg.
1228
950
  # @param optional block to be invoked when element method is called
1229
951
  #
1230
952
  def svg(name, identifier={:index => 0}, &block)
@@ -1242,14 +964,7 @@ module PageObject
1242
964
  #
1243
965
  # @param [Symbol] the name used for the generated methods
1244
966
  # @param [Symbol] the name of the tag for the element
1245
- # @param [Hash] identifier how we find an element. You can use a multiple parameters
1246
- # by combining of any of the following except xpath. The valid keys are:
1247
- # * :class => Watir and Selenium
1248
- # * :css => Watir and Selenium
1249
- # * :id => Watir and Selenium
1250
- # * :index => Watir and Selenium
1251
- # * :name => Watir and Selenium
1252
- # * :xpath => Watir and Selenium
967
+ # @param [Hash] identifier how we find an element.
1253
968
  # @param optional block to be invoked when element method is called
1254
969
  #
1255
970
  def element(name, tag=:element, identifier={ :index => 0 }, &block)
@@ -1310,14 +1025,7 @@ module PageObject
1310
1025
  #
1311
1026
  # @param [Symbol] the name used for the generated methods
1312
1027
  # @param [Symbol] the name of the tag for the element
1313
- # @param [Hash] identifier how we find an element. You can use a multiple parameters
1314
- # by combining of any of the following except xpath. The valid keys are:
1315
- # * :class => Watir and Selenium
1316
- # * :css => Watir and Selenium
1317
- # * :id => Watir and Selenium
1318
- # * :index => Watir and Selenium
1319
- # * :name => Watir and Selenium
1320
- # * :xpath => Watir and Selenium
1028
+ # @param [Hash] identifier how we find an element.
1321
1029
  # @param optional block to be invoked when element method is called
1322
1030
  #
1323
1031
  def elements(name, tag=:element, identifier={:index => 0}, &block)
@@ -1340,18 +1048,11 @@ module PageObject
1340
1048
  #
1341
1049
  # @example
1342
1050
  # page_section(:navigation_bar, NavigationBar, :id => 'nav-bar')
1343
- # # will generate 'navigation_bar' and 'navigation_bar?'
1051
+ # # will generate 'navigation_bar'
1344
1052
  #
1345
1053
  # @param [Symbol] the name used for the generated methods
1346
1054
  # @param [Class] the class to instantiate for the element
1347
- # @param [Hash] identifier how we find an element. You can use multiple parameters
1348
- # by combining of any of the following except xpath. The valid keys are:
1349
- # * :class => Watir and Selenium
1350
- # * :css => Watir and Selenium
1351
- # * :id => Watir and Selenium
1352
- # * :index => Watir and Selenium
1353
- # * :name => Watir and Selenium
1354
- # * :xpath => Watir and Selenium
1055
+ # @param [Hash] identifier how we find an element.
1355
1056
  #
1356
1057
  def page_section(name, section_class, identifier)
1357
1058
  define_method(name) do
@@ -1368,14 +1069,7 @@ module PageObject
1368
1069
  #
1369
1070
  # @param [Symbol] the name used for the generated method
1370
1071
  # @param [Class] the class to instantiate for each element
1371
- # @param [Hash] identifier how we find an element. You can use a multiple parameters
1372
- # by combining of any of the following except xpath. The valid keys are:
1373
- # * :class => Watir and Selenium
1374
- # * :css => Watir and Selenium
1375
- # * :id => Watir and Selenium
1376
- # * :index => Watir and Selenium
1377
- # * :name => Watir and Selenium
1378
- # * :xpath => Watir and Selenium
1072
+ # @param [Hash] identifier how we find an element.
1379
1073
  #
1380
1074
  def page_sections(name, section_class, identifier)
1381
1075
  define_method(name) do
@@ -1395,14 +1089,7 @@ module PageObject
1395
1089
  #
1396
1090
  # @param [Symbol] the name used for the generated methods
1397
1091
  # @param [Symbol] the name of the tag for the element
1398
- # @param [Hash] identifier how we find an element. You can use a multiple parameters
1399
- # by combining of any of the following except xpath. The valid keys are:
1400
- # * :class => Watir and Selenium
1401
- # * :css => Watir and Selenium
1402
- # * :id => Watir and Selenium
1403
- # * :index => Watir and Selenium
1404
- # * :name => Watir and Selenium
1405
- # * :xpath => Watir and Selenium
1092
+ # @param [Hash] identifier how we find an element.
1406
1093
  # @param optional block to be invoked when element method is called
1407
1094
  #
1408
1095
  LocatorGenerator::BASIC_ELEMENTS.each do |tag|