page-object 1.0.2 → 1.0.3
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/ChangeLog +10 -0
- data/README.md +1 -1
- data/features/bold.feature +21 -0
- data/features/html/indexed_property.html +14 -0
- data/features/html/multi_elements.html +1 -1
- data/features/html/static_elements.html +1 -2
- data/features/indexed_property.feature +15 -0
- data/features/multi_elements.feature +6 -0
- data/features/step_definitions/async_steps.rb +1 -1
- data/features/step_definitions/bold_steps.rb +12 -0
- data/features/step_definitions/check_box_steps.rb +2 -2
- data/features/step_definitions/indexed_property_steps.rb +47 -1
- data/features/step_definitions/label_steps.rb +1 -1
- data/features/step_definitions/multi_elements_steps.rb +13 -0
- data/features/step_definitions/select_list_steps.rb +1 -1
- data/features/step_definitions/table_steps.rb +4 -0
- data/features/support/page.rb +9 -0
- data/features/table.feature +12 -4
- data/lib/page-object.rb +6 -5
- data/lib/page-object/accessors.rb +78 -58
- data/lib/page-object/elements.rb +1 -0
- data/lib/page-object/elements/bold.rb +11 -0
- data/lib/page-object/elements/element.rb +12 -1
- data/lib/page-object/elements/table.rb +12 -1
- data/lib/page-object/indexed_properties.rb +20 -21
- data/lib/page-object/javascript/angularjs.rb +14 -0
- data/lib/page-object/javascript_framework_facade.rb +4 -2
- data/lib/page-object/locator_generator.rb +1 -0
- data/lib/page-object/page_populator.rb +0 -1
- data/lib/page-object/platforms/selenium_webdriver/button.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/element.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +26 -10
- data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +0 -7
- data/lib/page-object/platforms/watir_webdriver/element.rb +1 -1
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +23 -8
- data/lib/page-object/platforms/watir_webdriver/radio_button.rb +0 -7
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +7 -0
- data/page-object.gemspec +3 -3
- data/spec/page-object/accessors_spec.rb +40 -0
- data/spec/page-object/element_locators_spec.rb +340 -305
- data/spec/page-object/elements/area_spec.rb +8 -8
- data/spec/page-object/elements/bold_spec.rb +29 -0
- data/spec/page-object/elements/button_spec.rb +7 -7
- data/spec/page-object/elements/canvas_spec.rb +6 -6
- data/spec/page-object/elements/check_box_spec.rb +9 -9
- data/spec/page-object/elements/div_spec.rb +3 -3
- data/spec/page-object/elements/element_spec.rb +21 -21
- data/spec/page-object/elements/file_field_spec.rb +4 -4
- data/spec/page-object/elements/form_spec.rb +3 -3
- data/spec/page-object/elements/heading_spec.rb +8 -8
- data/spec/page-object/elements/hidden_field_spec.rb +3 -3
- data/spec/page-object/elements/image_spec.rb +14 -14
- data/spec/page-object/elements/label_spec.rb +3 -3
- data/spec/page-object/elements/link_spec.rb +6 -6
- data/spec/page-object/elements/list_item_spec.rb +4 -3
- data/spec/page-object/elements/nested_element_spec.rb +47 -47
- data/spec/page-object/elements/option_spec.rb +1 -1
- data/spec/page-object/elements/ordered_list_spec.rb +33 -33
- data/spec/page-object/elements/paragraph_spec.rb +3 -4
- data/spec/page-object/elements/select_list_spec.rb +52 -52
- data/spec/page-object/elements/selenium/radio_button_spec.rb +7 -13
- data/spec/page-object/elements/selenium/text_field_spec.rb +7 -7
- data/spec/page-object/elements/selenium_element_spec.rb +53 -53
- data/spec/page-object/elements/span_spec.rb +3 -3
- data/spec/page-object/elements/table_cell_spec.rb +3 -3
- data/spec/page-object/elements/table_row_spec.rb +22 -22
- data/spec/page-object/elements/table_spec.rb +28 -28
- data/spec/page-object/elements/text_area_spec.rb +5 -5
- data/spec/page-object/elements/unordered_list_spec.rb +33 -34
- data/spec/page-object/elements/watir_element_spec.rb +47 -48
- data/spec/page-object/javascript_framework_facade_spec.rb +6 -6
- data/spec/page-object/loads_platform_spec.rb +4 -4
- data/spec/page-object/page-object_spec.rb +103 -102
- data/spec/page-object/page_factory_spec.rb +43 -61
- data/spec/page-object/page_populator_spec.rb +44 -50
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +15 -15
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +6 -6
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +4 -4
- data/spec/page-object/platforms/watir_webdriver_spec.rb +1 -1
- data/spec/page-object/selenium_accessors_spec.rb +166 -153
- data/spec/page-object/watir_accessors_spec.rb +265 -245
- data/spec/page-object/widget_spec.rb +62 -30
- data/spec/spec_helper.rb +8 -8
- metadata +20 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10f43de4180ab498bb6929df07232deeee0ab0fb
|
4
|
+
data.tar.gz: fd5f9cb5d67e7af41c90a645e32e33a6babf2a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76cbc1ff4202177c001c56f574395cb7c233eca802acb1c7e448c709536c5af68cea6cb77be1bdbbf327ead2cc67f920de58da9513e218cf773b5ade4fd14fe5
|
7
|
+
data.tar.gz: eeca209c3157f4d49d6458952546f5130127c342f38d1515fb3c95e4bfaf81479c3147e8fb9ad0255d13ed98bb3e083bed1dc3b38890cf02a262305f49f98e44
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.1.
|
1
|
+
ruby-2.1.2
|
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== Version 1.0.3 / 2014-12-9
|
2
|
+
* Enhancements
|
3
|
+
* Added support for the bold tag (Thanks sedx)
|
4
|
+
* Added support for angularjs in wait_for_ajax (Thanks Owen Housden)
|
5
|
+
* Added hashes method to Table to return table contents as a Hash (Thanks Tobi)
|
6
|
+
* Fixed wait_for_expected_title so it detects if the title changes (Thanks Levi Wilson)
|
7
|
+
* Fixes
|
8
|
+
* Fixed issue that allows access to elements on other indexed properties (Thanks Dane Andersen)
|
9
|
+
* Removed the method to clear radio buttons. It didn't work on selenium and threw an exception on watir. (Thanks Justin Ko)
|
10
|
+
|
1
11
|
=== Version 1.0.2 / 2014-7-21
|
2
12
|
* Enhancements
|
3
13
|
* Added support to use multiple identifiers when locating nested frames / iframes (Thanks Justin Ko)
|
data/README.md
CHANGED
@@ -78,7 +78,7 @@ login_page.login_with 'cheezy', 'secret'
|
|
78
78
|
````
|
79
79
|
|
80
80
|
### Creating your page object
|
81
|
-
page-object supports both [watir-webdriver](https://github.com/jarib/watir-webdriver) and [selenium-webdriver](http://seleniumhq.org/docs/03_webdriver.html). The one used will be determined by which driver you pass into the constructor of your page object. The page object can be
|
81
|
+
page-object supports both [watir-webdriver](https://github.com/jarib/watir-webdriver) and [selenium-webdriver](http://seleniumhq.org/docs/03_webdriver.html). The one used will be determined by which driver you pass into the constructor of your page object. The page object can be created like this:
|
82
82
|
|
83
83
|
````ruby
|
84
84
|
browser = Watir::Browser.new :firefox
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Bold
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting the text of headings
|
7
|
+
When I get the bold text for the "b" element
|
8
|
+
Then I should see "some text in bold" in bold
|
9
|
+
|
10
|
+
Scenario Outline: Locating b on the Page
|
11
|
+
When I search bold text for the b by "<search_by>"
|
12
|
+
Then I should see "some text in bold" in bold
|
13
|
+
|
14
|
+
Scenarios:
|
15
|
+
| search_by |
|
16
|
+
| id |
|
17
|
+
| class |
|
18
|
+
| name |
|
19
|
+
| xpath |
|
20
|
+
| index |
|
21
|
+
| css |
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<td><input type="checkbox" id="table[123].check" value="1"/></td>
|
12
12
|
<td><textarea id="table[123].area" rows="2" cols="20"></textarea></td>
|
13
13
|
<td><input id="table[123].button" type="submit" value="Click 123"/></td>
|
14
|
+
<td><div id="table[123].content">123!</div></td>
|
14
15
|
</tr>
|
15
16
|
<tr>
|
16
17
|
<td><input type="text" id="table[foo].text" name="tableName[foo].text" size="20"/></td>
|
@@ -18,6 +19,7 @@
|
|
18
19
|
<td><input type="checkbox" id="table[foo].check" value="2"/></td>
|
19
20
|
<td><textarea id="table[foo].area" rows="2" cols="20"></textarea></td>
|
20
21
|
<td><input id="table[foo].button" type="submit" value="Click foo"/></td>
|
22
|
+
<td><div id="table[foo].content">foo!</div></td>
|
21
23
|
</tr>
|
22
24
|
<tr>
|
23
25
|
<td><input type="text" id="table[12test].text" name="tableName[12test].text" size="20"/></td>
|
@@ -25,6 +27,18 @@
|
|
25
27
|
<td><input type="checkbox" id="table[12test].check" value="3"/></td>
|
26
28
|
<td><textarea id="table[12test].area" rows="2" cols="20"></textarea></td>
|
27
29
|
<td><input id="table[12test].button" type="submit" value="Click 12test"/></td>
|
30
|
+
<td><div id="table[12test].content">12test!</div></td>
|
31
|
+
</tr>
|
32
|
+
</table>
|
33
|
+
|
34
|
+
<table id="other_table_id" name align="table_name" class="table_class" border="1">
|
35
|
+
<tr>
|
36
|
+
<td><input type="text" id="other_table[foo].text" name="otherTableName[foo].text" size="20"/></td>
|
37
|
+
<td><div id="other_table[foo].content">foo2!</div></td>
|
38
|
+
</tr>
|
39
|
+
<tr>
|
40
|
+
<td><input type="text" id="other_table[bar].text" name="otherTableName[bar].text" size="20"/></td>
|
41
|
+
<td><div id="other_table[bar].content">bar!</div></td>
|
28
42
|
</tr>
|
29
43
|
</table>
|
30
44
|
|
@@ -139,6 +139,6 @@
|
|
139
139
|
<input type="file" class="file_field_class" title="File Field 1" />
|
140
140
|
<input type="file" class="file_field_class" title="File Field 2" />
|
141
141
|
<input type="file" class="file_field_class" title="File Field 3" />
|
142
|
-
|
142
|
+
In bold <b>One B</b> and <b>Two B</b> for example text
|
143
143
|
</body>
|
144
144
|
</html>
|
@@ -176,7 +176,6 @@
|
|
176
176
|
<h4 id="h4_id" class="h4_class" name="h4_name">h4's are cool</h4>
|
177
177
|
<h5 id="h5_id" class="h5_class" name="h5_name">h5's are cool</h5>
|
178
178
|
<h6 id="h6_id" class="h6_class" name="h6_name">h6's are cool</h6>
|
179
|
-
|
180
179
|
<a href="success.html" target="_blank">New Window</a>
|
181
180
|
<a href="failure.html" target="_blank">Another New Window</a>
|
182
181
|
|
@@ -199,7 +198,7 @@
|
|
199
198
|
<figure id='figure_id'>
|
200
199
|
<img src="images/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
|
201
200
|
</figure>
|
202
|
-
|
201
|
+
This text have <b id="b_id" class="b_class" name="b_name">some text in bold</b>
|
203
202
|
</body>
|
204
203
|
</html>
|
205
204
|
|
@@ -81,3 +81,18 @@ Feature: Indexed Property
|
|
81
81
|
| foo |
|
82
82
|
| 123 |
|
83
83
|
| 12test |
|
84
|
+
|
85
|
+
Scenario: Element on first indexed property but not second
|
86
|
+
When I search for an element that is on an indexed property
|
87
|
+
And I search for the element on another indexed property it is not on
|
88
|
+
Then I should see that the element doesn't exist
|
89
|
+
|
90
|
+
Scenario: Index on first indexed property but not on second
|
91
|
+
When I search for an element by an index on an indexed property
|
92
|
+
And I search using the index which is not on another indexed property
|
93
|
+
Then I should see that the element doesn't exist for that index
|
94
|
+
|
95
|
+
Scenario: Index on first indexed property and different on second
|
96
|
+
When I search for an element with text by an index on an indexed property
|
97
|
+
And I search using an index which is on another indexed property
|
98
|
+
Then I should see the content of the element on the second indexed property
|
@@ -484,3 +484,9 @@ Feature: Multi Elements
|
|
484
484
|
And the text for label 1 should be "Label 1"
|
485
485
|
And the text for label 2 should be "Label 2"
|
486
486
|
And the text for label 3 should be "Label 3"
|
487
|
+
|
488
|
+
Scenario: Selecting bs using an identifier
|
489
|
+
When I select the bs
|
490
|
+
Then I should have 2 bs
|
491
|
+
And the text for b 1 should be "One B"
|
492
|
+
And the text for b 2 should be "Two B"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
When /^I get the bold text for the "([^\"]*)" element$/ do |el|
|
2
|
+
@b = @page.send "#{el}_id"
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^I should see "([^\"]*)" in bold$/ do |text|
|
6
|
+
@b.should == text
|
7
|
+
end
|
8
|
+
|
9
|
+
When /^I search bold text for the (\w+) by "([^"]*)"$/ do |text_decorator, type|
|
10
|
+
@b = @page.send "#{text_decorator}_#{type}"
|
11
|
+
end
|
12
|
+
|
@@ -3,7 +3,7 @@ When /^I select the First check box$/ do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /^the First check box should be selected$/ do
|
6
|
-
@page.cb_id_checked?.should
|
6
|
+
@page.cb_id_checked?.should be true
|
7
7
|
end
|
8
8
|
|
9
9
|
When /^I unselect the First check box$/ do
|
@@ -11,7 +11,7 @@ When /^I unselect the First check box$/ do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
Then /^the First check box should not be selected$/ do
|
14
|
-
@page.cb_id_checked?.should
|
14
|
+
@page.cb_id_checked?.should be false
|
15
15
|
end
|
16
16
|
|
17
17
|
When /^I search for the check box by "([^\"]*)"$/ do |how|
|
@@ -6,10 +6,16 @@ class IndexedPropertyPage
|
|
6
6
|
[:radio_button, :radio, {:id => 'table[%s].radio'}],
|
7
7
|
[:checkbox, :check, {:id => 'table[%s].check'}],
|
8
8
|
[:text_area, :area, {:id => 'table[%s].area'}],
|
9
|
-
[:button, :button, {:id => 'table[%s].button'}]
|
9
|
+
[:button, :button, {:id => 'table[%s].button'}],
|
10
|
+
[:div, :content, {:id => 'table[%s].content'}]]
|
10
11
|
|
11
12
|
indexed_property :nottable, [[:text_field, :text_nottable, {:id => 'nottable[%s].text'}]]
|
12
13
|
|
14
|
+
indexed_property :other_table, [
|
15
|
+
[:text_field, :text_table, {:id => 'other_table[%s].text'}],
|
16
|
+
[:div, :content, {:id => 'other_table[%s].content'}]
|
17
|
+
]
|
18
|
+
|
13
19
|
end
|
14
20
|
|
15
21
|
def page
|
@@ -81,3 +87,43 @@ Then /^The regular indexed text field by id should contain "([^\"]*)"$/ do |val|
|
|
81
87
|
page.nottable[@index].text_nottable.should == val
|
82
88
|
end
|
83
89
|
|
90
|
+
|
91
|
+
When(/^I search for an element not on my indexed property but on another$/) do
|
92
|
+
@index = 'foo'
|
93
|
+
end
|
94
|
+
|
95
|
+
Then(/^I should see that the element doesn't exist$/) do
|
96
|
+
expect { page.other_table[@index].radio_element.value }.to raise_error(NoMethodError)
|
97
|
+
end
|
98
|
+
|
99
|
+
When(/^I search for an element that is on an indexed property$/) do
|
100
|
+
page.table['foo'].radio_element
|
101
|
+
end
|
102
|
+
|
103
|
+
And(/^I search for the element on another indexed property it is not on$/) do
|
104
|
+
@index = 'foo'
|
105
|
+
end
|
106
|
+
|
107
|
+
When(/^I search using the index which is not on another indexed property$/) do
|
108
|
+
@index = '123'
|
109
|
+
end
|
110
|
+
|
111
|
+
Then(/^I should see that the element doesn't exist for that index/) do
|
112
|
+
expect { page.other_table[@index].text_table_element.text }.to raise_error /unable to locate element|Selenium::WebDriver::Error::NoSuchElementError/
|
113
|
+
end
|
114
|
+
|
115
|
+
When(/^I search for an element by an index on an indexed property$/) do
|
116
|
+
page.table['123'].text_table_element.html
|
117
|
+
end
|
118
|
+
|
119
|
+
And(/^I search using an index which is on another indexed property$/) do
|
120
|
+
@index = 'bar'
|
121
|
+
end
|
122
|
+
|
123
|
+
Then(/^I should see the content of the element on the second indexed property$/) do
|
124
|
+
expect(page.other_table['bar'].content).to eq 'bar!'
|
125
|
+
end
|
126
|
+
|
127
|
+
When(/^I search for an element with text by an index on an indexed property$/) do
|
128
|
+
expect(page.table['123'].content).to eq '123!'
|
129
|
+
end
|
@@ -31,6 +31,7 @@ class MultiElementsPage
|
|
31
31
|
labels(:the_labels, :class => 'label')
|
32
32
|
file_fields(:the_file_fields, :class => 'file_field_class')
|
33
33
|
elements(:generic_label, :label, :class => 'label')
|
34
|
+
b(:bs)
|
34
35
|
end
|
35
36
|
|
36
37
|
|
@@ -526,3 +527,15 @@ end
|
|
526
527
|
When(/^I select the multiple elements with a tag label$/) do
|
527
528
|
@elements = @page.generic_label_elements
|
528
529
|
end
|
530
|
+
|
531
|
+
When /^I select the bs$/ do
|
532
|
+
@elements = @page.b_elements
|
533
|
+
end
|
534
|
+
|
535
|
+
Then /^I should have (\d+) bs$/ do |num_bs|
|
536
|
+
@elements.size.should == num_bs.to_i
|
537
|
+
end
|
538
|
+
|
539
|
+
Then /^the text for b (\d+) should be "([^\"]*)"$/ do |b_num, text|
|
540
|
+
@elements[b_num.to_i - 1].text.should == text
|
541
|
+
end
|
@@ -40,7 +40,7 @@ Then /^the select list should include "([^\"]*)"$/ do |text|
|
|
40
40
|
end
|
41
41
|
|
42
42
|
Then /^the select list should know that "([^\"]*)" is selected$/ do |text|
|
43
|
-
@page.sel_list_id_element.selected?(text).should
|
43
|
+
@page.sel_list_id_element.selected?(text).should be true
|
44
44
|
end
|
45
45
|
|
46
46
|
Then /^the value for the option should be "([^\"]*)"$/ do |value|
|
@@ -64,3 +64,7 @@ end
|
|
64
64
|
Then /^I should see the text includes "([^"]*)" when I retrieve it by "([^"]*)"$/ do |text, how|
|
65
65
|
@page.send("table_#{how}").should include text
|
66
66
|
end
|
67
|
+
|
68
|
+
Then /^the table should be like the expected one$/ do |expected_table|
|
69
|
+
(expected_table.diff!@element.hashes).should be_nil
|
70
|
+
end
|
data/features/support/page.rb
CHANGED
@@ -360,5 +360,14 @@ class Page
|
|
360
360
|
figure(:figure_id, :id => 'figure_id')
|
361
361
|
|
362
362
|
svg(:svg_id, :id => 'the_svg')
|
363
|
+
|
364
|
+
b(:b_id, :id => 'b_id')
|
365
|
+
b(:b_class, :class => 'b_class')
|
366
|
+
b(:b_css, :css => '.b_class')
|
367
|
+
b(:b_name, :name => 'b_name')
|
368
|
+
b(:b_index, :index => 0)
|
369
|
+
b(:b_xpath, :xpath => '//b')
|
370
|
+
b(:b_class_index, :class => 'b_class', :index => 0)
|
371
|
+
b(:b_name_index, :name => 'b_name', :index => 0)
|
363
372
|
end
|
364
373
|
|
data/features/table.feature
CHANGED
@@ -38,7 +38,7 @@ Feature: Table
|
|
38
38
|
Scenario: Retrieve data from a table using a partial row header in the 2nd column
|
39
39
|
When I retrieve a table element
|
40
40
|
Then the data for row "ata4" should be "Data3" and "Data4"
|
41
|
-
|
41
|
+
|
42
42
|
Scenario: Retrieve data from a table using a column header
|
43
43
|
When I retrieve a table element
|
44
44
|
Then the data for column "Header" and row "3" should be "Data4"
|
@@ -54,11 +54,11 @@ Feature: Table
|
|
54
54
|
Scenario: Retrieve data from a table using a partial column header
|
55
55
|
When I retrieve a table element
|
56
56
|
Then the data for column "eader" and row "3" should be "Data4"
|
57
|
-
|
57
|
+
|
58
58
|
Scenario: Retrieve data from a table using both headers
|
59
59
|
When I retrieve a table element
|
60
60
|
Then the data for row "Data3" and column "eader" should be "Data4"
|
61
|
-
|
61
|
+
|
62
62
|
Scenario: Retrieve data from a table with an incorrect row header
|
63
63
|
When I retrieve a table element
|
64
64
|
Then the data for row "Data20" should be nil
|
@@ -83,6 +83,14 @@ Feature: Table
|
|
83
83
|
| index |
|
84
84
|
| name |
|
85
85
|
|
86
|
+
Scenario: Matching the expected table with the table on the Page
|
87
|
+
When I retrieve a table element
|
88
|
+
Then the table should be like the expected one
|
89
|
+
| Table | Header |
|
90
|
+
| Data1 | Data2 |
|
91
|
+
| Data3 | Data4 |
|
92
|
+
|
93
|
+
|
86
94
|
@selenium_only
|
87
95
|
Scenario Outline: Locating table cells on the Page
|
88
96
|
When I retrieve a table element by "<search_by>"
|
@@ -108,7 +116,7 @@ Feature: Table
|
|
108
116
|
@watir_only
|
109
117
|
Scenario: Finding an existing table
|
110
118
|
Then I should see that the table exists
|
111
|
-
|
119
|
+
|
112
120
|
Scenario: Getting the text from a table
|
113
121
|
Then I should see the text includes "Data1" when I retrieve it by "id"
|
114
122
|
And I should see the text includes "Data2" when I retrieve it by "id"
|
data/lib/page-object.rb
CHANGED
@@ -103,7 +103,8 @@ module PageObject
|
|
103
103
|
|
104
104
|
#
|
105
105
|
# Set the javascript framework to use when determining number of
|
106
|
-
# ajax requests. Valid frameworks are :jquery
|
106
|
+
# ajax requests. Valid frameworks are :jquery, :prototype, :yui,
|
107
|
+
# and :angularjs
|
107
108
|
#
|
108
109
|
def self.javascript_framework=(framework)
|
109
110
|
PageObject::JavascriptFrameworkFacade.framework = framework
|
@@ -196,7 +197,7 @@ module PageObject
|
|
196
197
|
end
|
197
198
|
|
198
199
|
#
|
199
|
-
# Override the normal alert popup so it does not
|
200
|
+
# Override the normal alert popup so it does not occur.
|
200
201
|
#
|
201
202
|
# @example
|
202
203
|
# message = @page.alert do
|
@@ -212,7 +213,7 @@ module PageObject
|
|
212
213
|
end
|
213
214
|
|
214
215
|
#
|
215
|
-
# Override the normal confirm popup so it does not
|
216
|
+
# Override the normal confirm popup so it does not occur.
|
216
217
|
#
|
217
218
|
# @example
|
218
219
|
# message = @popup.confirm(true) do
|
@@ -229,7 +230,7 @@ module PageObject
|
|
229
230
|
end
|
230
231
|
|
231
232
|
#
|
232
|
-
# Override the normal
|
233
|
+
# Override the normal prompt popup so it does not occur.
|
233
234
|
#
|
234
235
|
# @example
|
235
236
|
# message = @popup.prompt("Some Value") do
|
@@ -329,7 +330,7 @@ module PageObject
|
|
329
330
|
|
330
331
|
#
|
331
332
|
# Attach to a running window. You can locate the window using either
|
332
|
-
# the window's title or url. If it
|
333
|
+
# the window's title or url. If it fails to connect to a window it will
|
333
334
|
# pause for 1 second and try again.
|
334
335
|
#
|
335
336
|
# @example
|
@@ -13,7 +13,7 @@ module PageObject
|
|
13
13
|
module Accessors
|
14
14
|
|
15
15
|
#
|
16
|
-
# Set some values that can be used
|
16
|
+
# Set some values that can be used within the class. This is
|
17
17
|
# typically used to provide values that help build dynamic urls in
|
18
18
|
# the page_url method
|
19
19
|
#
|
@@ -66,20 +66,18 @@ module PageObject
|
|
66
66
|
#
|
67
67
|
def wait_for_expected_title(expected_title, timeout=::PageObject.default_element_wait)
|
68
68
|
define_method("wait_for_expected_title?") do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
raise "Expected title '#{expected_title}' instead of '#{page_title}'" unless has_expected_title
|
69
|
+
error_message = lambda { "Expected title '#{expected_title}' instead of '#{title}'" }
|
70
|
+
|
71
|
+
has_expected_title = (expected_title === title)
|
72
|
+
wait_until(timeout, error_message.call) do
|
73
|
+
has_expected_title = (expected_title === title)
|
74
|
+
end unless has_expected_title
|
75
|
+
|
76
|
+
raise error_message.call unless has_expected_title
|
78
77
|
has_expected_title
|
79
78
|
end
|
80
79
|
end
|
81
80
|
|
82
|
-
|
83
81
|
#
|
84
82
|
# Creates a method that compares the expected_title of a page against the actual.
|
85
83
|
# @param [String] expected_title the literal expected title for the page
|
@@ -195,7 +193,7 @@ module PageObject
|
|
195
193
|
# # 'first_name?' methods
|
196
194
|
#
|
197
195
|
# @param [String] the name used for the generated methods
|
198
|
-
# @param [Hash] identifier how we find a text field. You can use a multiple
|
196
|
+
# @param [Hash] identifier how we find a text field. You can use a multiple parameters
|
199
197
|
# by combining of any of the following except xpath. The valid keys are:
|
200
198
|
# * :class => Watir and Selenium
|
201
199
|
# * :css => Selenium only
|
@@ -231,7 +229,7 @@ module PageObject
|
|
231
229
|
# # will generate 'user_id', 'user_id_element' and 'user_id?' methods
|
232
230
|
#
|
233
231
|
# @param [String] the name used for the generated methods
|
234
|
-
# @param [Hash] identifier how we find a hidden field. You can use a multiple
|
232
|
+
# @param [Hash] identifier how we find a hidden field. You can use a multiple parameters
|
235
233
|
# by combining of any of the following except xpath. The valid keys are:
|
236
234
|
# * :class => Watir and Selenium
|
237
235
|
# * :css => Selenium only
|
@@ -263,7 +261,7 @@ module PageObject
|
|
263
261
|
# # 'address?' methods
|
264
262
|
#
|
265
263
|
# @param [String] the name used for the generated methods
|
266
|
-
# @param [Hash] identifier how we find a text area. You can use a multiple
|
264
|
+
# @param [Hash] identifier how we find a text area. You can use a multiple parameters
|
267
265
|
# by combining of any of the following except xpath. The valid keys are:
|
268
266
|
# * :class => Watir and Selenium
|
269
267
|
# * :css => Selenium only
|
@@ -299,7 +297,7 @@ module PageObject
|
|
299
297
|
# # will generate 'state', 'state=', 'state_element', 'state?', "state_options" methods
|
300
298
|
#
|
301
299
|
# @param [Symbol] the name used for the generated methods
|
302
|
-
# @param [Hash] identifier how we find a select list. You can use a multiple
|
300
|
+
# @param [Hash] identifier how we find a select list. You can use a multiple parameters
|
303
301
|
# by combining of any of the following except xpath. The valid keys are:
|
304
302
|
# * :class => Watir and Selenium
|
305
303
|
# * :css => Selenium only
|
@@ -339,7 +337,7 @@ module PageObject
|
|
339
337
|
# # will generate 'add_to_cart', 'add_to_cart_element', and 'add_to_cart?' methods
|
340
338
|
#
|
341
339
|
# @param [Symbol] the name used for the generated methods
|
342
|
-
# @param [Hash] identifier how we find a link. You can use a multiple
|
340
|
+
# @param [Hash] identifier how we find a link. You can use a multiple parameters
|
343
341
|
# by combining of any of the following except xpath. The valid keys are:
|
344
342
|
# * :class => Watir and Selenium
|
345
343
|
# * :css => Watir and Selenium
|
@@ -375,7 +373,7 @@ module PageObject
|
|
375
373
|
# # 'active_element', and 'active?' methods
|
376
374
|
#
|
377
375
|
# @param [Symbol] the name used for the generated methods
|
378
|
-
# @param [Hash] identifier how we find a checkbox. You can use a multiple
|
376
|
+
# @param [Hash] identifier how we find a checkbox. You can use a multiple parameters
|
379
377
|
# by combining of any of the following except xpath. The valid keys are:
|
380
378
|
# * :class => Watir and Selenium
|
381
379
|
# * :css => Selenium only
|
@@ -404,19 +402,18 @@ module PageObject
|
|
404
402
|
end
|
405
403
|
|
406
404
|
#
|
407
|
-
# adds
|
408
|
-
# another to return
|
409
|
-
# another method to return a PageObject::Elements::RadioButton
|
405
|
+
# adds four methods - one to select, another to return if a radio button
|
406
|
+
# is selected, another method to return a PageObject::Elements::RadioButton
|
410
407
|
# object representing the radio button element, and another to check
|
411
408
|
# the radio button's existence.
|
412
409
|
#
|
413
410
|
# @example
|
414
411
|
# radio_button(:north, :id => "north")
|
415
|
-
# # will generate 'select_north', '
|
412
|
+
# # will generate 'select_north', 'north_selected?',
|
416
413
|
# # 'north_element', and 'north?' methods
|
417
414
|
#
|
418
415
|
# @param [Symbol] the name used for the generated methods
|
419
|
-
# @param [Hash] identifier how we find a radio button. You can use a multiple
|
416
|
+
# @param [Hash] identifier how we find a radio button. You can use a multiple parameters
|
420
417
|
# by combining of any of the following except xpath. The valid keys are:
|
421
418
|
# * :class => Watir and Selenium
|
422
419
|
# * :css => Selenium only
|
@@ -434,10 +431,6 @@ module PageObject
|
|
434
431
|
return platform.select_radio(identifier.clone) unless block_given?
|
435
432
|
self.send("#{name}_element").select
|
436
433
|
end
|
437
|
-
define_method("clear_#{name}") do
|
438
|
-
return platform.clear_radio(identifier.clone) unless block_given?
|
439
|
-
self.send("#{name}_element").clear
|
440
|
-
end
|
441
434
|
define_method("#{name}_selected?") do
|
442
435
|
return platform.radio_selected?(identifier.clone) unless block_given?
|
443
436
|
self.send("#{name}_element").selected?
|
@@ -448,7 +441,7 @@ module PageObject
|
|
448
441
|
#
|
449
442
|
# adds five methods to help interact with a radio button group -
|
450
443
|
# a method to select a radio button in the group by given value/text,
|
451
|
-
# a method to return the values of all radio
|
444
|
+
# a method to return the values of all radio buttons in the group, a method
|
452
445
|
# to return if a radio button in the group is selected (will return
|
453
446
|
# the text of the selected radio button, if true), a method to return
|
454
447
|
# an array of PageObject::Elements::RadioButton objects representing
|
@@ -504,7 +497,7 @@ module PageObject
|
|
504
497
|
# # will generate 'purchase', 'purchase_element', and 'purchase?' methods
|
505
498
|
#
|
506
499
|
# @param [Symbol] the name used for the generated methods
|
507
|
-
# @param [Hash] identifier how we find a button. You can use a multiple
|
500
|
+
# @param [Hash] identifier how we find a button. You can use a multiple parameters
|
508
501
|
# by combining of any of the following except xpath. The valid keys are:
|
509
502
|
# * :class => Watir and Selenium
|
510
503
|
# * :css => Watir and Selenium
|
@@ -535,7 +528,7 @@ module PageObject
|
|
535
528
|
# # will generate 'message', 'message_element', and 'message?' methods
|
536
529
|
#
|
537
530
|
# @param [Symbol] the name used for the generated methods
|
538
|
-
# @param [Hash] identifier how we find a div. You can use a multiple
|
531
|
+
# @param [Hash] identifier how we find a div. You can use a multiple parameters
|
539
532
|
# by combining of any of the following except xpath. The valid keys are:
|
540
533
|
# * :class => Watir and Selenium
|
541
534
|
# * :css => Watir and Selenium
|
@@ -564,7 +557,7 @@ module PageObject
|
|
564
557
|
# # will generate 'alert', 'alert_element', and 'alert?' methods
|
565
558
|
#
|
566
559
|
# @param [Symbol] the name used for the generated methods
|
567
|
-
# @param [Hash] identifier how we find a span. You can use a multiple
|
560
|
+
# @param [Hash] identifier how we find a span. You can use a multiple parameters
|
568
561
|
# by combining of any of the following except xpath. The valid keys are:
|
569
562
|
# * :class => Watir and Selenium
|
570
563
|
# * :css => Watir and Selenium
|
@@ -595,7 +588,7 @@ module PageObject
|
|
595
588
|
# # will generate a 'cart', 'cart_element' and 'cart?' method
|
596
589
|
#
|
597
590
|
# @param [Symbol] the name used for the generated methods
|
598
|
-
# @param [Hash] identifier how we find a table. You can use a multiple
|
591
|
+
# @param [Hash] identifier how we find a table. You can use a multiple parameters
|
599
592
|
# by combining of any of the following except xpath. The valid keys are:
|
600
593
|
# * :class => Watir and Selenium
|
601
594
|
# * :css => Selenium only
|
@@ -623,7 +616,7 @@ module PageObject
|
|
623
616
|
# # will generate 'total', 'total_element', and 'total?' methods
|
624
617
|
#
|
625
618
|
# @param [Symbol] the name used for the generated methods
|
626
|
-
# @param [Hash] identifier how we find a cell. You can use a multiple
|
619
|
+
# @param [Hash] identifier how we find a cell. You can use a multiple parameters
|
627
620
|
# by combining of any of the following except xpath. The valid keys are:
|
628
621
|
# * :class => Watir and Selenium
|
629
622
|
# * :css => Watir and Selenium
|
@@ -653,7 +646,7 @@ module PageObject
|
|
653
646
|
# # will generate 'logo_element' and 'logo?' methods
|
654
647
|
#
|
655
648
|
# @param [Symbol] the name used for the generated methods
|
656
|
-
# @param [Hash] identifier how we find an image. You can use a multiple
|
649
|
+
# @param [Hash] identifier how we find an image. You can use a multiple parameters
|
657
650
|
# by combining of any of the following except xpath. The valid keys are:
|
658
651
|
# * :alt => Watir and Selenium
|
659
652
|
# * :class => Watir and Selenium
|
@@ -679,7 +672,7 @@ module PageObject
|
|
679
672
|
# # will generate 'login_element' and 'login?' methods
|
680
673
|
#
|
681
674
|
# @param [Symbol] the name used for the generated methods
|
682
|
-
# @param [Hash] identifier how we find a form. You can use a multiple
|
675
|
+
# @param [Hash] identifier how we find a form. You can use a multiple parameters
|
683
676
|
# by combining of any of the following except xpath. The valid keys are:
|
684
677
|
# * :action => Watir and Selenium
|
685
678
|
# * :class => Watir and Selenium
|
@@ -703,7 +696,7 @@ module PageObject
|
|
703
696
|
# # will generate 'item_one', 'item_one_element', and 'item_one?' methods
|
704
697
|
#
|
705
698
|
# @param [Symbol] the name used for the generated methods
|
706
|
-
# @param [Hash] identifier how we find a list item. You can use a multiple
|
699
|
+
# @param [Hash] identifier how we find a list item. You can use a multiple parameters
|
707
700
|
# by combining of any of the following except xpath. The valid keys are:
|
708
701
|
# * :class => Watir and Selenium
|
709
702
|
# * :css => Watir and Selenium
|
@@ -724,7 +717,7 @@ module PageObject
|
|
724
717
|
alias_method :li, :list_item
|
725
718
|
|
726
719
|
#
|
727
|
-
# adds three methods - one to return the text within the
|
720
|
+
# adds three methods - one to return the text within the unordered
|
728
721
|
# list, one to retrieve the unordered list element, and another to
|
729
722
|
# check it's existence.
|
730
723
|
#
|
@@ -733,7 +726,7 @@ module PageObject
|
|
733
726
|
# # will generate 'menu', 'menu_element' and 'menu?' methods
|
734
727
|
#
|
735
728
|
# @param [Symbol] the name used for the generated methods
|
736
|
-
# @param [Hash] identifier how we find an unordered list. You can use a multiple
|
729
|
+
# @param [Hash] identifier how we find an unordered list. You can use a multiple parameters
|
737
730
|
# by combining of any of the following except xpath. The valid keys are:
|
738
731
|
# * :class => Watir and Selenium
|
739
732
|
# * :css => Selenium only
|
@@ -753,7 +746,7 @@ module PageObject
|
|
753
746
|
alias_method :ul, :unordered_list
|
754
747
|
|
755
748
|
#
|
756
|
-
# adds three methods - one to return the text
|
749
|
+
# adds three methods - one to return the text within the ordered
|
757
750
|
# list, one to retrieve the ordered list element, and another to
|
758
751
|
# test it's existence.
|
759
752
|
#
|
@@ -762,7 +755,7 @@ module PageObject
|
|
762
755
|
# # will generate 'top_five', 'top_five_element' and 'top_five?' methods
|
763
756
|
#
|
764
757
|
# @param [Symbol] the name used for the generated methods
|
765
|
-
# @param [Hash] identifier how we find an ordered list. You can use a multiple
|
758
|
+
# @param [Hash] identifier how we find an ordered list. You can use a multiple parameters
|
766
759
|
# by combining of any of the following except xpath. The valid keys are:
|
767
760
|
# * :class => Watir and Selenium
|
768
761
|
# * :css => Selenium only
|
@@ -790,7 +783,7 @@ module PageObject
|
|
790
783
|
# # will generate 'title', 'title_element', and 'title?' methods
|
791
784
|
#
|
792
785
|
# @param [Symbol] the name used for the generated methods
|
793
|
-
# @param [Hash] identifier how we find a H1. You can use a multiple
|
786
|
+
# @param [Hash] identifier how we find a H1. You can use a multiple parameters
|
794
787
|
# by combining of any of the following except xpath. The valid keys are:
|
795
788
|
# * :class => Watir and Selenium
|
796
789
|
# * :css => Watir and Selenium
|
@@ -817,7 +810,7 @@ module PageObject
|
|
817
810
|
# # will generate 'title', 'title_element', and 'title?' methods
|
818
811
|
#
|
819
812
|
# @param [Symbol] the name used for the generated methods
|
820
|
-
# @param [Hash] identifier how we find a H2. You can use a multiple
|
813
|
+
# @param [Hash] identifier how we find a H2. You can use a multiple parameters
|
821
814
|
# by combining of any of the following except xpath. The valid keys are:
|
822
815
|
# * :class => Watir and Selenium
|
823
816
|
# * :css => Watir and Selenium
|
@@ -844,7 +837,7 @@ module PageObject
|
|
844
837
|
# # will generate 'title', 'title_element', and 'title?' methods
|
845
838
|
#
|
846
839
|
# @param [Symbol] the name used for the generated methods
|
847
|
-
# @param [Hash] identifier how we find a H3. You can use a multiple
|
840
|
+
# @param [Hash] identifier how we find a H3. You can use a multiple parameters
|
848
841
|
# by combining of any of the following except xpath. The valid keys are:
|
849
842
|
# * :class => Watir and Selenium
|
850
843
|
# * :css => Watir and Selenium
|
@@ -871,7 +864,7 @@ module PageObject
|
|
871
864
|
# # will generate 'title', 'title_element', and 'title?' methods
|
872
865
|
#
|
873
866
|
# @param [Symbol] the name used for the generated methods
|
874
|
-
# @param [Hash] identifier how we find a H4. You can use a multiple
|
867
|
+
# @param [Hash] identifier how we find a H4. You can use a multiple parameters
|
875
868
|
# by combining of any of the following except xpath. The valid keys are:
|
876
869
|
# * :class => Watir and Selenium
|
877
870
|
# * :css => Watir and Selenium
|
@@ -898,7 +891,7 @@ module PageObject
|
|
898
891
|
# # will generate 'title', 'title_element', and 'title?' methods
|
899
892
|
#
|
900
893
|
# @param [Symbol] the name used for the generated methods
|
901
|
-
# @param [Hash] identifier how we find a H5. You can use a multiple
|
894
|
+
# @param [Hash] identifier how we find a H5. You can use a multiple parameters
|
902
895
|
# by combining of any of the following except xpath. The valid keys are:
|
903
896
|
# * :class => Watir and Selenium
|
904
897
|
# * :css => Watir and Selenium
|
@@ -925,7 +918,7 @@ module PageObject
|
|
925
918
|
# # will generate 'title', 'title_element', and 'title?' methods
|
926
919
|
#
|
927
920
|
# @param [Symbol] the name used for the generated methods
|
928
|
-
# @param [Hash] identifier how we find a H6. You can use a multiple
|
921
|
+
# @param [Hash] identifier how we find a H6. You can use a multiple parameters
|
929
922
|
# by combining of any of the following except xpath. The valid keys are:
|
930
923
|
# * :class => Watir and Selenium
|
931
924
|
# * :css => Watir and Selenium
|
@@ -952,7 +945,7 @@ module PageObject
|
|
952
945
|
# # will generate 'title', 'title_element', and 'title?' methods
|
953
946
|
#
|
954
947
|
# @param [Symbol] the name used for the generated methods
|
955
|
-
# @param [Hash] identifier how we find a paragraph. You can use a multiple
|
948
|
+
# @param [Hash] identifier how we find a paragraph. You can use a multiple parameters
|
956
949
|
# by combining of any of the following except xpath. The valid keys are:
|
957
950
|
# * :class => Watir and Selenium
|
958
951
|
# * :css => Watir and Selenium
|
@@ -980,7 +973,7 @@ module PageObject
|
|
980
973
|
# # will generate 'the_file=', 'the_file_element', and 'the_file?' methods
|
981
974
|
#
|
982
975
|
# @param [Symbol] the name used for the generated methods
|
983
|
-
# @param [Hash] identifier how we find a file_field. You can use a multiple
|
976
|
+
# @param [Hash] identifier how we find a file_field. You can use a multiple parameters
|
984
977
|
# by combining of any of the following except xpath. The valid keys are:
|
985
978
|
# * :class => Watir and Selenium
|
986
979
|
# * :css => Selenium only
|
@@ -1009,7 +1002,7 @@ module PageObject
|
|
1009
1002
|
# # will generate 'message', 'message_element', and 'message?' methods
|
1010
1003
|
#
|
1011
1004
|
# @param [Symbol] the name used for the generated methods
|
1012
|
-
# @param [Hash] identifier how we find a label. You can use a multiple
|
1005
|
+
# @param [Hash] identifier how we find a label. You can use a multiple parameters
|
1013
1006
|
# by combining of any of the following except xpath. The valid keys are:
|
1014
1007
|
# * :class => Watir and Selenium
|
1015
1008
|
# * :css => Watir and Selenium
|
@@ -1037,7 +1030,7 @@ module PageObject
|
|
1037
1030
|
# # will generate 'message', 'message_element', and 'message?' methods
|
1038
1031
|
#
|
1039
1032
|
# @param [Symbol] the name used for the generated methods
|
1040
|
-
# @param [Hash] identifier how we find an area. You can use a multiple
|
1033
|
+
# @param [Hash] identifier how we find an area. You can use a multiple parameters
|
1041
1034
|
# by combining of any of the following except xpath. The valid keys are:
|
1042
1035
|
# * :class => Watir and Selenium
|
1043
1036
|
# * :css => Watir and Selenium
|
@@ -1065,7 +1058,7 @@ module PageObject
|
|
1065
1058
|
# # will generate 'my_canvas_element' and 'my_canvas?' methods
|
1066
1059
|
#
|
1067
1060
|
# @param [Symbol] the name used for the generated methods
|
1068
|
-
# @param [Hash] identifier how we find a canvas. You can use a multiple
|
1061
|
+
# @param [Hash] identifier how we find a canvas. You can use a multiple parameters
|
1069
1062
|
# by combining of any of the following except xpath. The valid keys are:
|
1070
1063
|
# * :class => Watir and Selenium
|
1071
1064
|
# * :css => Watir and Selenium
|
@@ -1088,7 +1081,7 @@ module PageObject
|
|
1088
1081
|
# # will generate 'acdc_element' and 'acdc?' methods
|
1089
1082
|
#
|
1090
1083
|
# @param [Symbol] the name used for the generated methods
|
1091
|
-
# @param [Hash] identifier how we find an audio element. You can use a multiple
|
1084
|
+
# @param [Hash] identifier how we find an audio element. You can use a multiple parameters
|
1092
1085
|
# by combining of any of the following except xpath. The valid keys are:
|
1093
1086
|
# * :class => Watir and Selenium
|
1094
1087
|
# * :css => Watir and Selenium
|
@@ -1111,7 +1104,7 @@ module PageObject
|
|
1111
1104
|
# # will generate 'movie_element' and 'movie?' methods
|
1112
1105
|
#
|
1113
1106
|
# @param [Symbol] the name used for the generated methods
|
1114
|
-
# @param [Hash] identifier how we find a video element. You can use a multiple
|
1107
|
+
# @param [Hash] identifier how we find a video element. You can use a multiple parameters
|
1115
1108
|
# by combining of any of the following except xpath. The valid keys are:
|
1116
1109
|
# * :class => Watir and Selenium
|
1117
1110
|
# * :css => Watir and Selenium
|
@@ -1125,6 +1118,33 @@ module PageObject
|
|
1125
1118
|
standard_methods(name, identifier, 'video_for', &block)
|
1126
1119
|
end
|
1127
1120
|
|
1121
|
+
#
|
1122
|
+
# adds three methods - one to retrieve the text of a b element, another to
|
1123
|
+
# retrieve a b element, and another to check for it's existence.
|
1124
|
+
#
|
1125
|
+
# @example
|
1126
|
+
# b(:bold, :id => 'title')
|
1127
|
+
# # will generate 'bold', 'bold_element', and 'bold?' methods
|
1128
|
+
#
|
1129
|
+
# @param [Symbol] the name used for the generated methods
|
1130
|
+
# @param [Hash] identifier how we find a b. You can use a multiple parameters
|
1131
|
+
# by combining of any of the following except xpath. The valid keys are:
|
1132
|
+
# * :class => Watir and Selenium
|
1133
|
+
# * :css => Watir and Selenium
|
1134
|
+
# * :id => Watir and Selenium
|
1135
|
+
# * :index => Watir and Selenium
|
1136
|
+
# * :name => Watir and Selenium
|
1137
|
+
# * :xpath => Watir and Selenium
|
1138
|
+
# @param optional block to be invoked when element method is called
|
1139
|
+
#
|
1140
|
+
def b(name, identifier={:index => 0}, &block)
|
1141
|
+
standard_methods(name, identifier,'b_for', &block)
|
1142
|
+
define_method(name) do
|
1143
|
+
return platform.b_text_for identifier.clone unless block_given?
|
1144
|
+
self.send("#{name}_element").text
|
1145
|
+
end
|
1146
|
+
end
|
1147
|
+
|
1128
1148
|
#
|
1129
1149
|
# adds two methods - one to retrieve a svg, and another to check
|
1130
1150
|
# the svg's existence.
|
@@ -1134,7 +1154,7 @@ module PageObject
|
|
1134
1154
|
# # will generate 'circle_element', and 'circle?' methods
|
1135
1155
|
#
|
1136
1156
|
# @param [Symbol] the name used for the generated methods
|
1137
|
-
# @param [Hash] identifier how we find a svg. You can use a multiple
|
1157
|
+
# @param [Hash] identifier how we find a svg. You can use a multiple parameters
|
1138
1158
|
# by combining of any of the following except xpath. The valid keys are:
|
1139
1159
|
# * :class => Watir and Selenium
|
1140
1160
|
# * :css => Selenium only
|
@@ -1159,7 +1179,7 @@ module PageObject
|
|
1159
1179
|
#
|
1160
1180
|
# @param [Symbol] the name used for the generated methods
|
1161
1181
|
# @param [Symbol] the name of the tag for the element
|
1162
|
-
# @param [Hash] identifier how we find an element. You can use a multiple
|
1182
|
+
# @param [Hash] identifier how we find an element. You can use a multiple parameters
|
1163
1183
|
# by combining of any of the following except xpath. The valid keys are:
|
1164
1184
|
# * :class => Watir and Selenium
|
1165
1185
|
# * :css => Selenium only
|
@@ -1192,7 +1212,7 @@ module PageObject
|
|
1192
1212
|
#
|
1193
1213
|
# @param [Symbol] the name used for the generated methods
|
1194
1214
|
# @param [Symbol] the name of the tag for the element
|
1195
|
-
# @param [Hash] identifier how we find an element. You can use a multiple
|
1215
|
+
# @param [Hash] identifier how we find an element. You can use a multiple parameters
|
1196
1216
|
# by combining of any of the following except xpath. The valid keys are:
|
1197
1217
|
# * :class => Watir and Selenium
|
1198
1218
|
# * :css => Selenium only
|
@@ -1221,7 +1241,7 @@ module PageObject
|
|
1221
1241
|
#
|
1222
1242
|
# @param [Symbol] the name used for the generated methods
|
1223
1243
|
# @param [Symbol] the name of the tag for the element
|
1224
|
-
# @param [Hash] identifier how we find an element. You can use a multiple
|
1244
|
+
# @param [Hash] identifier how we find an element. You can use a multiple parameters
|
1225
1245
|
# by combining of any of the following except xpath. The valid keys are:
|
1226
1246
|
# * :class => Watir and Selenium
|
1227
1247
|
# * :css => Selenium only
|
@@ -1286,14 +1306,14 @@ module PageObject
|
|
1286
1306
|
#
|
1287
1307
|
# methods to fetch multiple elements of the same type
|
1288
1308
|
#
|
1289
|
-
# adds a method to the page object to
|
1309
|
+
# adds a method to the page object to return all of the matching elements
|
1290
1310
|
#
|
1291
1311
|
# @example
|
1292
1312
|
# text_fields(:first_name, :id => "first_name")
|
1293
1313
|
# # will generate 'first_name_elements'
|
1294
1314
|
#
|
1295
1315
|
# @param [String] the name used for the generated methods
|
1296
|
-
# @param [Hash] identifier how we find a text field. You can use a multiple
|
1316
|
+
# @param [Hash] identifier how we find a text field. You can use a multiple parameters
|
1297
1317
|
# by combining of any of the following except xpath. The valid
|
1298
1318
|
# keys are the same ones supported by the standard methods.
|
1299
1319
|
# @param optional block to be invoked when element method is called
|