page-object 0.3.2 → 0.4.0

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 (41) hide show
  1. data/ChangeLog +16 -0
  2. data/features/headings.feature +42 -6
  3. data/features/html/nested_elements.html +11 -5
  4. data/features/html/static_elements.html +1 -1
  5. data/features/nested_elements.feature +19 -3
  6. data/features/paragraph.feature +33 -0
  7. data/features/step_definitions/nested_elements_steps.rb +12 -16
  8. data/features/step_definitions/paragraph_steps.rb +16 -0
  9. data/features/support/page.rb +32 -0
  10. data/lib/page-object/accessors.rb +116 -0
  11. data/lib/page-object/element_locators.rb +60 -0
  12. data/lib/page-object/elements/button.rb +3 -1
  13. data/lib/page-object/elements/check_box.rb +4 -2
  14. data/lib/page-object/elements/element.rb +23 -3
  15. data/lib/page-object/elements/form.rb +4 -2
  16. data/lib/page-object/elements/image.rb +4 -2
  17. data/lib/page-object/elements/link.rb +3 -1
  18. data/lib/page-object/elements/ordered_list.rb +4 -2
  19. data/lib/page-object/elements/paragraph.rb +7 -0
  20. data/lib/page-object/elements/radio_button.rb +4 -2
  21. data/lib/page-object/elements/select_list.rb +4 -2
  22. data/lib/page-object/elements/table.rb +4 -2
  23. data/lib/page-object/elements/table_row.rb +4 -2
  24. data/lib/page-object/elements/text_area.rb +4 -2
  25. data/lib/page-object/elements/text_field.rb +4 -2
  26. data/lib/page-object/elements/unordered_list.rb +4 -2
  27. data/lib/page-object/elements.rb +1 -0
  28. data/lib/page-object/nested_elements.rb +16 -0
  29. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +120 -0
  30. data/lib/page-object/platforms/watir_webdriver/page_object.rb +100 -0
  31. data/lib/page-object/version.rb +1 -1
  32. data/lib/page-object.rb +22 -0
  33. data/page-object.gemspec +3 -2
  34. data/spec/page-object/accessors_spec.rb +212 -31
  35. data/spec/page-object/element_locators_spec.rb +24 -0
  36. data/spec/page-object/elements/element_spec.rb +9 -250
  37. data/spec/page-object/elements/nested_element_spec.rb +125 -86
  38. data/spec/page-object/elements/selenium_element_spec.rb +128 -0
  39. data/spec/page-object/elements/watir_element_spec.rb +116 -0
  40. data/spec/page-object/page-object_spec.rb +32 -0
  41. metadata +30 -10
data/ChangeLog CHANGED
@@ -1,3 +1,19 @@
1
+ === Version 0.4 / 2011-09-24
2
+ * Enhancements
3
+ * Added all of the h4 locators
4
+ * Added all of the h5 locators
5
+ * Added all of the h6 locators
6
+ * Added all of the paragraph locators
7
+ * Added the Paragraph class
8
+ * Added #click to Element
9
+ * Added #style to Element
10
+ * Added #inspect to Element
11
+ * Added #current_url to PageObject
12
+ * Added #clear_cookies to PageObject
13
+ * Added #save_screenshot to PageObject
14
+ * Updated to use selenium-webdriver 2.7.0
15
+ * Updated to use watir-webdriver 0.3.4
16
+
1
17
  === Version 0.3.2 / 2011-09-22
2
18
  * Enhancements
3
19
  * Element#when_present now returns the element object
@@ -10,12 +10,12 @@ Feature: Headings
10
10
  Then I should see "h2's are cool"
11
11
  When I get the text for the "h3" element
12
12
  Then I should see "h3's are cool"
13
- # When I get the text for the "h4" element
14
- # Then I should see "h4's are cool"
15
- # When I get the text for the "h5" element
16
- # Then I should see "h5's are cool"
17
- # When I get the text for the "h6" element
18
- # Then I should see "h6's are cool"
13
+ When I get the text for the "h4" element
14
+ Then I should see "h4's are cool"
15
+ When I get the text for the "h5" element
16
+ Then I should see "h5's are cool"
17
+ When I get the text for the "h6" element
18
+ Then I should see "h6's are cool"
19
19
 
20
20
  Scenario Outline: Locating h1s on the Page
21
21
  When I search for the heading1 by "<search_by>"
@@ -52,3 +52,39 @@ Feature: Headings
52
52
  | name |
53
53
  | xpath |
54
54
  | index |
55
+
56
+ Scenario Outline: Locating h4s on the Page
57
+ When I search for the heading4 by "<search_by>"
58
+ Then I should see "h4's are cool"
59
+
60
+ Scenarios:
61
+ | search_by |
62
+ | id |
63
+ | class |
64
+ | name |
65
+ | xpath |
66
+ | index |
67
+
68
+ Scenario Outline: Locating h5s on the Page
69
+ When I search for the heading5 by "<search_by>"
70
+ Then I should see "h5's are cool"
71
+
72
+ Scenarios:
73
+ | search_by |
74
+ | id |
75
+ | class |
76
+ | name |
77
+ | xpath |
78
+ | index |
79
+
80
+ Scenario Outline: Locating h6s on the Page
81
+ When I search for the heading6 by "<search_by>"
82
+ Then I should see "h6's are cool"
83
+
84
+ Scenarios:
85
+ | search_by |
86
+ | id |
87
+ | class |
88
+ | name |
89
+ | xpath |
90
+ | index |
@@ -27,7 +27,16 @@
27
27
  <table>
28
28
  <tr><td>Data1</td><td>Data2</td></tr>
29
29
  </table>
30
- <img src="images/circle.png">
30
+ <img src="images/circle.png"/>
31
+ <p>This is a paragraph.</p>
32
+
33
+ <h1>h1's are cool</h1>
34
+ <h2>h2's are cool</h2>
35
+ <h3>h3's are cool</h3>
36
+ <h4>h4's are cool</h4>
37
+ <h5>h5's are cool</h5>
38
+ <h6>h6's are cool</h6>
39
+
31
40
  <ol>
32
41
  <li>Number One</li>
33
42
  <li>Number Two</li>
@@ -36,11 +45,8 @@
36
45
  <li>Item One</li>
37
46
  <li>Item Two</li>
38
47
  </ul
39
-
48
+
40
49
  </div>
41
- <h1>h1's are cool</h1>
42
- <h2>h2's are cool</h2>
43
- <h3>h3's are cool</h3>
44
50
 
45
51
  </body>
46
52
  </html>
@@ -3,7 +3,7 @@
3
3
  <title>Static Elements Page</title>
4
4
  </head>
5
5
  <body>
6
- <p>Static Elements Page</p>
6
+ <p id='p_id' name='p_name' class='p_class'>Static Elements Page</p>
7
7
 
8
8
  <input id="text_field_id" name="text_field_name" class="text_field_class"
9
9
  size="40" type="text"/>
@@ -73,14 +73,30 @@ Feature: Nested Elements
73
73
  Then I should see the nested list items text should be "Number One"
74
74
 
75
75
  Scenario: Finding a h1 within a div
76
- When I search for a h1 located list in a div
76
+ When I search for a h1 located in a div
77
77
  Then I should see the nested h1s text should be "h1's are cool"
78
78
 
79
79
  Scenario: Finding a h2 within a div
80
- When I search for a h2 located list in a div
80
+ When I search for a h2 located in a div
81
81
  Then I should see the nested h2s text should be "h2's are cool"
82
82
 
83
83
  Scenario: Finding a h3 within a div
84
- When I search for a h3 located list in a div
84
+ When I search for a h3 located in a div
85
85
  Then I should see the nested h3s text should be "h3's are cool"
86
86
 
87
+ Scenario: Finding a h4 within a div
88
+ When I search for a h4 located in a div
89
+ Then I should see the nested h4s text should be "h4's are cool"
90
+
91
+ Scenario: Finding a h5 within a div
92
+ When I search for a h5 located in a div
93
+ Then I should see the nested h5s text should be "h5's are cool"
94
+
95
+ Scenario: Finding a h6 within a div
96
+ When I search for a h6 located in a div
97
+ Then I should see the nested h6s text should be "h6's are cool"
98
+
99
+ Scenario: Finding a paragraph within a div
100
+ When I search for a paragraph located in a div
101
+ Then I should see the nested paragraphs text should be "This is a paragraph."
102
+
@@ -0,0 +1,33 @@
1
+ Feature: Paragraph
2
+
3
+ Background:
4
+ Given I am on the static elements page
5
+
6
+ Scenario: Getting the text from a paragraph
7
+ When I get the text from the paragraph
8
+ Then the text should be "Static Elements Page"
9
+
10
+ Scenario Outline: Locating paragraphs on the page
11
+ When I search for the paragraph by "<search_by>"
12
+ Then the text should be "Static Elements Page"
13
+
14
+ Scenarios:
15
+ | search_by |
16
+ | id |
17
+ | class |
18
+ | xpath |
19
+ | index |
20
+ | name |
21
+
22
+ Scenario Outline: Locating paragraphs using multiple parameters
23
+ When I search for the paragraph by "<param1>" and "<param2>"
24
+ Then the text should be "Static Elements Page"
25
+
26
+ Scenarios:
27
+ | param1 | param2 |
28
+ | class | index |
29
+ | name | index |
30
+
31
+ Scenario: Finding a paragraph dynamically
32
+ When I get the text from a paragraph while the script is executing
33
+ Then the text should be "Static Elements Page"
@@ -22,6 +22,10 @@ class NestedElementsPage
22
22
  h1(:nested_h1) { |page| page.outer_div_element.h1_element}
23
23
  h2(:nested_h2) { |page| page.outer_div_element.h2_element }
24
24
  h3(:nested_h3) { |page| page.outer_div_element.h3_element }
25
+ h4(:nested_h4) { |page| page.outer_div_element.h4_element }
26
+ h5(:nested_h5) { |page| page.outer_div_element.h5_element }
27
+ h6(:nested_h6) { |page| page.outer_div_element.h6_element }
28
+ paragraph(:nested_paragraph) { |page| page.outer_div_element.paragraph_element }
25
29
  end
26
30
 
27
31
  Given /^I am on the nested elements page$/ do
@@ -167,26 +171,18 @@ Then /^I should see the nested list items text should be "([^"]*)"$/ do |value|
167
171
  @li.text.should == value
168
172
  end
169
173
 
170
- When /^I search for a h1 located list in a div$/ do
171
- @h1 = @page.nested_h1_element
174
+ When /^I search for a h(\d+) located in a div$/ do |num|
175
+ @header = @page.send "nested_h#{num}_element"
172
176
  end
173
177
 
174
- Then /^I should see the nested h1s text should be "([^"]*)"$/ do |value|
175
- @h1.text.should == value
178
+ Then /^I should see the nested h(\d+)s text should be "([^"]*)"$/ do |num, value|
179
+ @header.text.should == value
176
180
  end
177
181
 
178
- When /^I search for a h2 located list in a div$/ do
179
- @h2 = @page.nested_h2_element
182
+ When /^I search for a paragraph located in a div$/ do
183
+ @para = @page.nested_paragraph_element
180
184
  end
181
185
 
182
- Then /^I should see the nested h2s text should be "([^"]*)"$/ do |value|
183
- @h2.text.should == value
184
- end
185
-
186
- When /^I search for a h3 located list in a div$/ do
187
- @h3 = @page.nested_h3_element
188
- end
189
-
190
- Then /^I should see the nested h3s text should be "([^"]*)"$/ do |value|
191
- @h3.text.should == value
186
+ Then /^I should see the nested paragraphs text should be "([^"]*)"$/ do |value|
187
+ @para.text.should == value
192
188
  end
@@ -0,0 +1,16 @@
1
+
2
+ When /^I get the text from the paragraph$/ do
3
+ @text = @page.p_id
4
+ end
5
+
6
+ When /^I search for the paragraph by "([^"]*)"$/ do |how|
7
+ @text = @page.send "p_#{how}".to_sym
8
+ end
9
+
10
+ When /^I search for the paragraph by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
11
+ @text = @page.send "p_#{param1}_#{param2}"
12
+ end
13
+
14
+ When /^I get the text from a paragraph while the script is executing$/ do
15
+ @text = @page.paragraph_element(:id => 'p_id').text
16
+ end
@@ -188,6 +188,38 @@ class Page
188
188
  h3(:h3_class_index, :class => 'h3_class', :index => 0)
189
189
  h3(:h3_name_index, :name => 'h3_name', :index => 0)
190
190
 
191
+ h4(:h4_id, :id => 'h4_id')
192
+ h4(:h4_class, :class => 'h4_class')
193
+ h4(:h4_name, :name => 'h4_name')
194
+ h4(:h4_index, :index => 0)
195
+ h4(:h4_xpath, :xpath => '//h4')
196
+ h4(:h4_class_index, :class => 'h4_class', :index => 0)
197
+ h4(:h4_name_index, :name => 'h4_name', :index => 0)
198
+
199
+ h5(:h5_id, :id => 'h5_id')
200
+ h5(:h5_class, :class => 'h5_class')
201
+ h5(:h5_name, :name => 'h5_name')
202
+ h5(:h5_index, :index => 0)
203
+ h5(:h5_xpath, :xpath => '//h5')
204
+ h5(:h5_class_index, :class => 'h5_class', :index => 0)
205
+ h5(:h5_name_index, :name => 'h5_name', :index => 0)
206
+
207
+ h6(:h6_id, :id => 'h6_id')
208
+ h6(:h6_class, :class => 'h6_class')
209
+ h6(:h6_name, :name => 'h6_name')
210
+ h6(:h6_index, :index => 0)
211
+ h6(:h6_xpath, :xpath => '//h6')
212
+ h6(:h6_class_index, :class => 'h6_class', :index => 0)
213
+ h6(:h6_name_index, :name => 'h6_name', :index => 0)
214
+
215
+ paragraph(:p_id, :id => 'p_id')
216
+ paragraph(:p_class, :class => 'p_class')
217
+ paragraph(:p_name, :name => 'p_name')
218
+ paragraph(:p_index, :index => 0)
219
+ paragraph(:p_xpath, :xpath => '//p')
220
+ paragraph(:p_class_index, :class => 'p_class', :index => 0)
221
+ paragraph(:p_name_index, :name => 'p_name', :index => 0)
222
+
191
223
  button(:alert_button, :id => 'alert_button')
192
224
  button(:confirm_button, :id => 'confirm_button')
193
225
  button(:prompt_button, :id => 'prompt_button')
@@ -668,5 +668,121 @@ module PageObject
668
668
  end
669
669
  alias_method "#{name}_h3".to_sym, "#{name}_element".to_sym
670
670
  end
671
+
672
+ #
673
+ # adds a method to retrieve the text of a h4 and a h4 element
674
+ #
675
+ # @example
676
+ # h4(:title, :id => 'title')
677
+ # # will generate a 'title' and 'title_element' method
678
+ #
679
+ # @param [String] the name used for the generated methods
680
+ # @param [Hash] identifier how we find a H4. You can use a multiple paramaters
681
+ # by combining of any of the following except xpath. The valid keys are:
682
+ # * :class => Watir and Selenium
683
+ # * :id => Watir and Selenium
684
+ # * :index => Watir and Selenium
685
+ # * :name => Watir and Selenium
686
+ # * :xpath => Watir and Selenium
687
+ # @param optional block to be invoked when element method is called
688
+ #
689
+ def h4(name, identifier=nil, &block)
690
+ define_method(name) do
691
+ return platform.h4_text_for identifier.clone unless block_given?
692
+ self.send("#{name}_element").text
693
+ end
694
+ define_method("#{name}_element") do
695
+ return call_block(&block) if block_given?
696
+ platform.h4_for(identifier.clone)
697
+ end
698
+ alias_method "#{name}_h4".to_sym, "#{name}_element".to_sym
699
+ end
700
+
701
+ #
702
+ # adds a method to retrieve the text of a h5 and a h5 element
703
+ #
704
+ # @example
705
+ # h5(:title, :id => 'title')
706
+ # # will generate a 'title' and 'title_element' method
707
+ #
708
+ # @param [String] the name used for the generated methods
709
+ # @param [Hash] identifier how we find a H5. You can use a multiple paramaters
710
+ # by combining of any of the following except xpath. The valid keys are:
711
+ # * :class => Watir and Selenium
712
+ # * :id => Watir and Selenium
713
+ # * :index => Watir and Selenium
714
+ # * :name => Watir and Selenium
715
+ # * :xpath => Watir and Selenium
716
+ # @param optional block to be invoked when element method is called
717
+ #
718
+ def h5(name, identifier=nil, &block)
719
+ define_method(name) do
720
+ return platform.h5_text_for identifier.clone unless block_given?
721
+ self.send("#{name}_element").text
722
+ end
723
+ define_method("#{name}_element") do
724
+ return call_block(&block) if block_given?
725
+ platform.h5_for(identifier.clone)
726
+ end
727
+ alias_method "#{name}_h5".to_sym, "#{name}_element".to_sym
728
+ end
729
+
730
+ #
731
+ # adds a method to retrieve the text of a h6 and a h6 element
732
+ #
733
+ # @example
734
+ # h6(:title, :id => 'title')
735
+ # # will generate a 'title' and 'title_element' method
736
+ #
737
+ # @param [String] the name used for the generated methods
738
+ # @param [Hash] identifier how we find a H6. You can use a multiple paramaters
739
+ # by combining of any of the following except xpath. The valid keys are:
740
+ # * :class => Watir and Selenium
741
+ # * :id => Watir and Selenium
742
+ # * :index => Watir and Selenium
743
+ # * :name => Watir and Selenium
744
+ # * :xpath => Watir and Selenium
745
+ # @param optional block to be invoked when element method is called
746
+ #
747
+ def h6(name, identifier=nil, &block)
748
+ define_method(name) do
749
+ return platform.h6_text_for identifier.clone unless block_given?
750
+ self.send("#{name}_element").text
751
+ end
752
+ define_method("#{name}_element") do
753
+ return call_block(&block) if block_given?
754
+ platform.h6_for(identifier.clone)
755
+ end
756
+ alias_method "#{name}_h6".to_sym, "#{name}_element".to_sym
757
+ end
758
+
759
+ #
760
+ # adds a method to retrieve the text of a paragraph and a paragraph element
761
+ #
762
+ # @example
763
+ # h6(:title, :id => 'title')
764
+ # # will generate a 'title' and 'title_element' method
765
+ #
766
+ # @param [String] the name used for the generated methods
767
+ # @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters
768
+ # by combining of any of the following except xpath. The valid keys are:
769
+ # * :class => Watir and Selenium
770
+ # * :id => Watir and Selenium
771
+ # * :index => Watir and Selenium
772
+ # * :name => Watir and Selenium
773
+ # * :xpath => Watir and Selenium
774
+ # @param optional block to be invoked when element method is called
775
+ #
776
+ def paragraph(name, identifier=nil, &block)
777
+ define_method(name) do
778
+ return platform.paragraph_text_for identifier.clone unless block_given?
779
+ self.send("#{name}_element").text
780
+ end
781
+ define_method("#{name}_element") do
782
+ return call_block(&block) if block_given?
783
+ platform.paragraph_for(identifier.clone)
784
+ end
785
+ alias_method "#{name}_paragraph".to_sym, "#{name}_element".to_sym
786
+ end
671
787
  end
672
788
  end
@@ -318,5 +318,65 @@ module PageObject
318
318
  def h3_element(identifier)
319
319
  platform.h3_for(identifier.clone)
320
320
  end
321
+
322
+ #
323
+ # Finds a h4
324
+ #
325
+ # @param [Hash] identifier how we find a H4. You can use a multiple paramaters
326
+ # by combining of any of the following except xpath. The valid keys are:
327
+ # * :class => Watir and Selenium
328
+ # * :id => Watir and Selenium
329
+ # * :index => Watir and Selenium
330
+ # * :name => Watir and Selenium
331
+ # * :xpath => Watir and Selenium
332
+ #
333
+ def h4_element(identifier)
334
+ platform.h4_for(identifier.clone)
335
+ end
336
+
337
+ #
338
+ # Finds a h5
339
+ #
340
+ # @param [Hash] identifier how we find a H5. You can use a multiple paramaters
341
+ # by combining of any of the following except xpath. The valid keys are:
342
+ # * :class => Watir and Selenium
343
+ # * :id => Watir and Selenium
344
+ # * :index => Watir and Selenium
345
+ # * :name => Watir and Selenium
346
+ # * :xpath => Watir and Selenium
347
+ #
348
+ def h5_element(identifier)
349
+ platform.h5_for(identifier.clone)
350
+ end
351
+
352
+ #
353
+ # Finds a h6
354
+ #
355
+ # @param [Hash] identifier how we find a H6. You can use a multiple paramaters
356
+ # by combining of any of the following except xpath. The valid keys are:
357
+ # * :class => Watir and Selenium
358
+ # * :id => Watir and Selenium
359
+ # * :index => Watir and Selenium
360
+ # * :name => Watir and Selenium
361
+ # * :xpath => Watir and Selenium
362
+ #
363
+ def h6_element(identifier)
364
+ platform.h6_for(identifier.clone)
365
+ end
366
+
367
+ #
368
+ # Finds a paragraph
369
+ #
370
+ # @param [Hash] identifier how we find a paragraph. You can use a multiple paramaters
371
+ # by combining of any of the following except xpath. The valid keys are:
372
+ # * :class => Watir and Selenium
373
+ # * :id => Watir and Selenium
374
+ # * :index => Watir and Selenium
375
+ # * :name => Watir and Selenium
376
+ # * :xpath => Watir and Selenium
377
+ #
378
+ def paragraph_element(identifier)
379
+ platform.paragraph_for(identifier.clone)
380
+ end
321
381
  end
322
382
  end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class Button < Element
@@ -21,7 +23,7 @@ module PageObject
21
23
  super
22
24
  if platform[:platform] == :selenium_webdriver
23
25
  require 'page-object/platforms/selenium_webdriver/button'
24
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::Button
26
+ self.mixin PageObject::Platforms::SeleniumWebDriver::Button
25
27
  end
26
28
  end
27
29
  end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class CheckBox < Element
@@ -13,10 +15,10 @@ module PageObject
13
15
  super
14
16
  if platform[:platform] == :watir_webdriver
15
17
  require 'page-object/platforms/watir_webdriver/check_box'
16
- self.class.send :include, PageObject::Platforms::WatirWebDriver::CheckBox
18
+ self.mixin PageObject::Platforms::WatirWebDriver::CheckBox
17
19
  elsif platform[:platform] == :selenium_webdriver
18
20
  require 'page-object/platforms/selenium_webdriver/check_box'
19
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::CheckBox
21
+ self.mixin PageObject::Platforms::SeleniumWebDriver::CheckBox
20
22
  else
21
23
  raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
22
24
  end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  #
@@ -16,6 +18,24 @@ module PageObject
16
18
  include_platform_for platform
17
19
  end
18
20
 
21
+ #
22
+ # click the element
23
+ #
24
+ def click
25
+ @element.click
26
+ end
27
+
28
+ #
29
+ # get the value of the given CSS property
30
+ #
31
+ def style(property)
32
+ @element.style property
33
+ end
34
+
35
+ def inspect
36
+ @element.inspect
37
+ end
38
+
19
39
  # @private
20
40
  def self.watir_identifier_for identifier
21
41
  if should_build_watir_xpath(identifier)
@@ -58,7 +78,7 @@ module PageObject
58
78
  protected
59
79
 
60
80
  def self.should_build_watir_xpath identifier
61
- ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3'].include? identifier[:tag_name] and identifier[:name]
81
+ ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'].include? identifier[:tag_name] and identifier[:name]
62
82
  end
63
83
 
64
84
  def self.build_xpath_for identifier
@@ -137,12 +157,12 @@ module PageObject
137
157
  if platform[:platform] == :watir_webdriver
138
158
  require 'page-object/platforms/watir_webdriver/element'
139
159
  require 'page-object/platforms/watir_webdriver/page_object'
140
- self.class.send :include, PageObject::Platforms::WatirWebDriver::Element
160
+ self.mixin PageObject::Platforms::WatirWebDriver::Element
141
161
  @platform = PageObject::Platforms::WatirWebDriver::PageObject.new(@element)
142
162
  elsif platform[:platform] == :selenium_webdriver
143
163
  require 'page-object/platforms/selenium_webdriver/element'
144
164
  require 'page-object/platforms/selenium_webdriver/page_object'
145
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::Element
165
+ self.mixin PageObject::Platforms::SeleniumWebDriver::Element
146
166
  @platform = PageObject::Platforms::SeleniumWebDriver::PageObject.new(@element)
147
167
  else
148
168
  raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class Form < Element
@@ -12,10 +14,10 @@ module PageObject
12
14
  super
13
15
  if platform[:platform] == :watir_webdriver
14
16
  require 'page-object/platforms/watir_webdriver/form'
15
- self.class.send :include, PageObject::Platforms::WatirWebDriver::Form
17
+ self.mixin PageObject::Platforms::WatirWebDriver::Form
16
18
  elsif platform[:platform] == :selenium_webdriver
17
19
  require 'page-object/platforms/selenium_webdriver/form'
18
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::Form
20
+ self.mixin PageObject::Platforms::SeleniumWebDriver::Form
19
21
  else
20
22
  raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
21
23
  end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class Image < Element
@@ -12,10 +14,10 @@ module PageObject
12
14
  super
13
15
  if platform[:platform] == :watir_webdriver
14
16
  require 'page-object/platforms/watir_webdriver/image'
15
- self.class.send :include, PageObject::Platforms::WatirWebDriver::Image
17
+ self.mixin PageObject::Platforms::WatirWebDriver::Image
16
18
  elsif platform[:platform] == :selenium_webdriver
17
19
  require 'page-object/platforms/selenium_webdriver/image'
18
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::Image
20
+ self.mixin PageObject::Platforms::SeleniumWebDriver::Image
19
21
  else
20
22
  raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
21
23
  end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class Link < Element
@@ -29,7 +31,7 @@ module PageObject
29
31
  super
30
32
  if platform[:platform] == :selenium_webdriver
31
33
  require 'page-object/platforms/selenium_webdriver/link'
32
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::Link
34
+ self.mixin PageObject::Platforms::SeleniumWebDriver::Link
33
35
  end
34
36
  end
35
37
  end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class OrderedList < Element
@@ -33,10 +35,10 @@ module PageObject
33
35
  super
34
36
  if platform[:platform] == :watir_webdriver
35
37
  require 'page-object/platforms/watir_webdriver/ordered_list'
36
- self.class.send :include, PageObject::Platforms::WatirWebDriver::OrderedList
38
+ self.mixin PageObject::Platforms::WatirWebDriver::OrderedList
37
39
  elsif platform[:platform] == :selenium_webdriver
38
40
  require 'page-object/platforms/selenium_webdriver/ordered_list'
39
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::OrderedList
41
+ self.mixin PageObject::Platforms::SeleniumWebDriver::OrderedList
40
42
  else
41
43
  raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
42
44
  end
@@ -0,0 +1,7 @@
1
+ module PageObject
2
+ module Elements
3
+ class Paragraph < Element
4
+
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,5 @@
1
+ require 'mixology'
2
+
1
3
  module PageObject
2
4
  module Elements
3
5
  class RadioButton < Element
@@ -13,10 +15,10 @@ module PageObject
13
15
  super
14
16
  if platform[:platform] == :watir_webdriver
15
17
  require 'page-object/platforms/watir_webdriver/radio_button'
16
- self.class.send :include, PageObject::Platforms::WatirWebDriver::RadioButton
18
+ self.mixin PageObject::Platforms::WatirWebDriver::RadioButton
17
19
  elsif platform[:platform] == :selenium_webdriver
18
20
  require 'page-object/platforms/selenium_webdriver/radio_button'
19
- self.class.send :include, PageObject::Platforms::SeleniumWebDriver::RadioButton
21
+ self.mixin PageObject::Platforms::SeleniumWebDriver::RadioButton
20
22
  else
21
23
  raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
22
24
  end