symbiont 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +10 -39
- data/HISTORY.md +6 -0
- data/lib/symbiont.rb +8 -4
- data/lib/symbiont/enclosers.rb +4 -4
- data/lib/symbiont/evaluators.rb +22 -29
- data/lib/symbiont/generators.rb +82 -317
- data/lib/symbiont/platform_selenium.rb +18 -0
- data/lib/symbiont/platform_selenium/platform_object.rb +236 -0
- data/lib/symbiont/platform_selenium/web_objects/button.rb +13 -0
- data/lib/symbiont/platform_selenium/web_objects/checkbox.rb +21 -0
- data/lib/symbiont/platform_selenium/web_objects/common.rb +104 -0
- data/lib/symbiont/platform_selenium/web_objects/link.rb +13 -0
- data/lib/symbiont/platform_selenium/web_objects/radio.rb +21 -0
- data/lib/symbiont/platform_selenium/web_objects/select_list.rb +79 -0
- data/lib/symbiont/platform_selenium/web_objects/table.rb +40 -0
- data/lib/symbiont/platform_selenium/web_objects/table_row.rb +36 -0
- data/lib/symbiont/platform_selenium/web_objects/text_field.rb +14 -0
- data/lib/symbiont/platform_watir.rb +13 -4
- data/lib/symbiont/platform_watir/platform_object.rb +74 -262
- data/lib/symbiont/platform_watir/web_objects/checkbox.rb +21 -0
- data/lib/symbiont/platform_watir/web_objects/common.rb +82 -0
- data/lib/symbiont/platform_watir/web_objects/radio.rb +21 -0
- data/lib/symbiont/platform_watir/web_objects/select_list.rb +67 -0
- data/lib/symbiont/platform_watir/web_objects/table.rb +31 -0
- data/lib/symbiont/platform_watir/web_objects/table_row.rb +31 -0
- data/lib/symbiont/platform_watir/web_objects/text_field.rb +13 -0
- data/lib/symbiont/platforms.rb +18 -6
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +53 -74
- data/lib/symbiont/web_objects/button.rb +23 -4
- data/lib/symbiont/web_objects/checkbox.rb +24 -10
- data/lib/symbiont/web_objects/div.rb +9 -1
- data/lib/symbiont/web_objects/link.rb +25 -4
- data/lib/symbiont/web_objects/paragraph.rb +11 -0
- data/lib/symbiont/web_objects/radio.rb +27 -1
- data/lib/symbiont/web_objects/select_list.rb +20 -56
- data/lib/symbiont/web_objects/span.rb +9 -1
- data/lib/symbiont/web_objects/table.rb +19 -22
- data/lib/symbiont/web_objects/table_cell.rb +17 -1
- data/lib/symbiont/web_objects/table_row.rb +18 -25
- data/lib/symbiont/web_objects/text_field.rb +27 -11
- data/symbiont.gemspec +3 -8
- metadata +29 -122
- data/app/Gemfile +0 -4
- data/app/app.rb +0 -181
- data/app/config/database.rb +0 -9
- data/app/models/plan.rb +0 -10
- data/app/models/product.rb +0 -10
- data/app/models/study.rb +0 -11
- data/app/models/user.rb +0 -13
- data/app/public/css/style.css +0 -138
- data/app/views/create_plan.erb +0 -21
- data/app/views/create_product.erb +0 -15
- data/app/views/create_study.erb +0 -24
- data/app/views/create_user.erb +0 -60
- data/app/views/db_plans.erb +0 -31
- data/app/views/db_products.erb +0 -29
- data/app/views/db_studies.erb +0 -33
- data/app/views/db_users.erb +0 -23
- data/app/views/entity_list.erb +0 -10
- data/app/views/index.erb +0 -8
- data/app/views/layout.erb +0 -39
- data/app/views/login_page.erb +0 -17
- data/app/views/success_1.erb +0 -2
- data/app/views/success_2.erb +0 -2
- data/app/views/test_database.erb +0 -13
- data/app/views/test_events.erb +0 -51
- data/app/views/test_login.erb +0 -53
- data/app/views/test_login_error.erb +0 -22
- data/app/views/test_login_success.erb +0 -22
- data/app/views/test_page.erb +0 -184
- data/specs/button.feature +0 -44
- data/specs/checkbox.feature +0 -40
- data/specs/data_setter.feature +0 -29
- data/specs/definitions/pages.rb +0 -156
- data/specs/div.feature +0 -11
- data/specs/evaluators.feature +0 -17
- data/specs/events.feature +0 -30
- data/specs/frame.feature +0 -5
- data/specs/link.feature +0 -42
- data/specs/locators.feature +0 -17
- data/specs/radio.feature +0 -38
- data/specs/select_list.feature +0 -50
- data/specs/simple_test.feature +0 -13
- data/specs/span.feature +0 -11
- data/specs/support/env.rb +0 -20
- data/specs/support/hooks.rb +0 -11
- data/specs/support/test_steps/action_steps_buttons.rb +0 -70
- data/specs/support/test_steps/action_steps_checkboxes.rb +0 -75
- data/specs/support/test_steps/action_steps_data_setter.rb +0 -56
- data/specs/support/test_steps/action_steps_divs.rb +0 -18
- data/specs/support/test_steps/action_steps_evaluators.rb +0 -15
- data/specs/support/test_steps/action_steps_events.rb +0 -77
- data/specs/support/test_steps/action_steps_frames.rb +0 -13
- data/specs/support/test_steps/action_steps_links.rb +0 -61
- data/specs/support/test_steps/action_steps_locators.rb +0 -44
- data/specs/support/test_steps/action_steps_navigate.rb +0 -25
- data/specs/support/test_steps/action_steps_radios.rb +0 -75
- data/specs/support/test_steps/action_steps_select_lists.rb +0 -106
- data/specs/support/test_steps/action_steps_spans.rb +0 -18
- data/specs/support/test_steps/action_steps_tables.rb +0 -82
- data/specs/support/test_steps/action_steps_text_fields.rb +0 -107
- data/specs/support/test_steps/action_steps_webobjects.rb +0 -31
- data/specs/support/test_steps/simple_test_steps.rb +0 -8
- data/specs/table.feature +0 -39
- data/specs/text_field.feature +0 -47
- data/specs/web_object.feature +0 -15
@@ -0,0 +1,40 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module Platforms
|
3
|
+
module SeleniumWebDriver
|
4
|
+
module Table
|
5
|
+
|
6
|
+
# This method is used to return a TableRow object based on the index provided. When
|
7
|
+
# the index provided is a string, the text will be matched with the text from the first
|
8
|
+
# column.
|
9
|
+
# @return [Symbiont::WebObjects::TableRow]
|
10
|
+
def [](index)
|
11
|
+
all_rows = table_rows
|
12
|
+
index = find_by_title(index, all_rows) if index.kind_of?(String)
|
13
|
+
return nil unless index
|
14
|
+
::Symbiont::WebObjects::TableRow.new(all_rows[index], :platform => :selenium_webdriver)
|
15
|
+
end
|
16
|
+
|
17
|
+
# This method will return the number of rows in a table.
|
18
|
+
def rows
|
19
|
+
table_rows.size
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_by_title(row_text, all_rows)
|
23
|
+
all_rows.find_index do |row|
|
24
|
+
columns = row.find_elements(:xpath, ".//child::td|th")
|
25
|
+
columns.any? { |col| col.text.include? row_text }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def table_rows
|
30
|
+
web_object.find_elements(:xpath, row_xpath)
|
31
|
+
end
|
32
|
+
|
33
|
+
def exists?
|
34
|
+
raise "Currently Selenium is not very good at checking if a table exists."
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Symbiont
|
2
|
+
module Platforms
|
3
|
+
module SeleniumWebDriver
|
4
|
+
module TableRow
|
5
|
+
|
6
|
+
# This method is used to return a TableCell object based on the index provided. When
|
7
|
+
# the index provided is a string, the text will be matched with the text from the
|
8
|
+
# columns in the first row.
|
9
|
+
# @return [Symbiont::WebObjects::TableCell]
|
10
|
+
def [](index)
|
11
|
+
all_cells = table_cells
|
12
|
+
index = find_by_title(index) if index.kind_of?(String)
|
13
|
+
return nil unless index && columns >= idx + 1
|
14
|
+
::Symbiont::WebObjects::TableCell.new(all_cells[index], :platform => :selenium_webdriver)
|
15
|
+
end
|
16
|
+
|
17
|
+
# This method returns the number of columns in a table object.
|
18
|
+
def columns
|
19
|
+
table_cells.size
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_by_title(column_text)
|
23
|
+
table = parent
|
24
|
+
parent_tag = parent.web_object.tag_name
|
25
|
+
table = table.parent if (parent_tag == 'tbody' || parent_tag == 'thead')
|
26
|
+
table[0].find_index { |column| column.text.include? column_text }
|
27
|
+
end
|
28
|
+
|
29
|
+
def table_cells
|
30
|
+
web_object.find_elements(:xpath, cell_xpath)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -2,8 +2,17 @@ module Symbiont
|
|
2
2
|
module Platforms
|
3
3
|
module WatirWebDriver
|
4
4
|
|
5
|
-
|
5
|
+
def self.create_platform_object_for(browser)
|
6
|
+
require_relative 'platform_watir/platform_object'
|
7
|
+
return WatirWebDriver::PlatformObject.new(browser)
|
8
|
+
end
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
+
def self.works_with(browser)
|
11
|
+
browser.is_a?(::Watir::Browser)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Symbiont::Platforms.register(:watir_webdriver, Symbiont::Platforms::WatirWebDriver)
|
@@ -10,57 +10,45 @@ module Symbiont
|
|
10
10
|
|
11
11
|
## Browser-Level Actions ##
|
12
12
|
|
13
|
-
# Platform method to make a call to a specified URL.
|
14
|
-
# See Symbiont#visit
|
15
13
|
def visit(url)
|
16
14
|
@browser.goto(url)
|
17
15
|
end
|
18
16
|
|
19
|
-
# Platform method to get the URL of the active page.
|
20
|
-
# See Symbiont#url
|
21
17
|
def url
|
22
18
|
@browser.url
|
23
19
|
end
|
24
20
|
|
25
|
-
# Platform method to save the current screenshot to a file.
|
26
|
-
# See Symbiont#screenshot
|
27
21
|
def screenshot(file)
|
28
22
|
@browser.wd.save_screenshot(file)
|
29
23
|
end
|
30
24
|
|
31
|
-
# Platform method to run a script against the browser.
|
32
|
-
# See Symbiont#run_script
|
33
25
|
def run_script(script)
|
34
26
|
@browser.execute_script(script)
|
35
27
|
end
|
28
|
+
|
29
|
+
def back
|
30
|
+
@browser.back
|
31
|
+
end
|
36
32
|
|
37
33
|
## Page-Level Actions ##
|
38
34
|
|
39
|
-
# Platform method to retrieve text from the current page.
|
40
|
-
# See Symbiont#text
|
41
35
|
def text
|
42
36
|
@browser.text
|
43
37
|
end
|
44
38
|
|
45
|
-
# Platform method to retrieve markup from the current page.
|
46
|
-
# See Symbiont#markup
|
47
39
|
def markup
|
48
40
|
@browser.html
|
49
41
|
end
|
50
42
|
|
51
|
-
# Platform method to get the title of the current page.
|
52
|
-
# See Symbiont#title
|
53
43
|
def title
|
54
44
|
@browser.title
|
55
45
|
end
|
56
46
|
|
57
|
-
# Platform method to get the web object that has focus.
|
58
|
-
# See Symbiont#focus
|
59
47
|
def focus
|
60
48
|
web_object = @browser.execute_script("return document.activeElement")
|
61
49
|
type = web_object.type.to_sym if web_object.tag_name.to_sym == :input
|
62
50
|
object_class = ::Symbiont::WebObjects.get_class_for(web_object.tag_name, type)
|
63
|
-
object_class.new(web_object)
|
51
|
+
object_class.new(web_object, :platform => :watir_webdriver)
|
64
52
|
end
|
65
53
|
|
66
54
|
## Encloser Methods ##
|
@@ -108,238 +96,103 @@ module Symbiont
|
|
108
96
|
end
|
109
97
|
|
110
98
|
## Generator Methods ##
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
action = check_for_css("link(locator)", locator)
|
117
|
-
reference_web_object(action, WebObjects::Link, locator)
|
118
|
-
end
|
119
|
-
|
120
|
-
# Platform method to get text of link object.
|
121
|
-
# @see Symbiont::Generators#link
|
122
|
-
def get_link_text_for(locator)
|
123
|
-
access_web_object("link(locator).text", WebObjects::Link, locator)
|
99
|
+
|
100
|
+
## Paragraphs ##
|
101
|
+
|
102
|
+
def paragraph_element(locator)
|
103
|
+
reference_web_object("p(locator)", WebObjects::Paragraph, locator)
|
124
104
|
end
|
125
105
|
|
126
|
-
|
127
|
-
|
128
|
-
def click_link_for(locator)
|
129
|
-
action = check_for_css("link(locator)", locator)
|
130
|
-
access_web_object("#{action}.click", WebObjects::Link, locator)
|
106
|
+
def paragraph_text_for(locator)
|
107
|
+
access_web_object("p(locator).text", WebObjects::Paragraph, locator)
|
131
108
|
end
|
132
109
|
|
133
|
-
|
134
|
-
|
135
|
-
def
|
136
|
-
|
110
|
+
## Links ##
|
111
|
+
|
112
|
+
def link_element(locator)
|
113
|
+
reference_web_object("link(locator)", WebObjects::Link, locator)
|
137
114
|
end
|
138
115
|
|
139
|
-
|
140
|
-
|
141
|
-
def check_link_for_visibility(locator)
|
142
|
-
access_web_object("link(locator).visible?", WebObjects::Link, locator)
|
116
|
+
def click_link_for(locator)
|
117
|
+
access_web_object("link(locator).click", WebObjects::Link, locator)
|
143
118
|
end
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
def get_button_for(locator)
|
149
|
-
action = check_for_css("button(locator)", locator)
|
119
|
+
|
120
|
+
## Buttons ##
|
121
|
+
|
122
|
+
def button_element(locator)
|
150
123
|
reference_web_object("button(locator)", WebObjects::Button, locator)
|
151
124
|
end
|
152
125
|
|
153
|
-
# Platform method to get text of button object.
|
154
|
-
# @see Symbiont::Generators#button
|
155
|
-
def get_button_text_for(locator)
|
156
|
-
access_web_object("button(locator).text", WebObjects::Button, locator)
|
157
|
-
end
|
158
|
-
|
159
|
-
# Platform method to click a button object.
|
160
|
-
# @see Symbiont::Generators#button
|
161
126
|
def click_button_for(locator)
|
162
|
-
|
163
|
-
access_web_object("#{action}.click", WebObjects::Button, locator)
|
127
|
+
access_web_object("button(locator).click", WebObjects::Button, locator)
|
164
128
|
end
|
165
129
|
|
166
|
-
|
167
|
-
# @see Symbiont::Generators#button
|
168
|
-
def check_button_for_existence(locator)
|
169
|
-
access_web_object("button(locator).exists?", WebObjects::Button, locator)
|
170
|
-
end
|
171
|
-
|
172
|
-
# Platform method to check if button object is visible.
|
173
|
-
# @see Symbiont::Generators#button
|
174
|
-
def check_button_for_visibility(locator)
|
175
|
-
access_web_object("button(locator).visible?", WebObjects::Button, locator)
|
176
|
-
end
|
177
|
-
|
178
|
-
# Platform method to check if button object is enabled.
|
179
|
-
# @see Symbiont::Generators#button
|
180
|
-
def check_button_for_enabled(locator)
|
181
|
-
access_web_object("button(locator).enabled?", WebObjects::Button, locator)
|
182
|
-
end
|
130
|
+
## Text Fields ##
|
183
131
|
|
184
|
-
|
185
|
-
# Text field objects are of type: Symbiont::WebObjects::TextField
|
186
|
-
# @see Symbiont::Generators#text_field
|
187
|
-
def get_text_field_for(locator)
|
132
|
+
def text_field_element(locator)
|
188
133
|
reference_web_object("text_field(locator)", WebObjects::TextField, locator)
|
189
134
|
end
|
190
135
|
|
191
|
-
# Platform method to retrieve text from a text field object.
|
192
|
-
# @see Symbiont::Generators#text_field
|
193
136
|
def get_text_field_value_for(locator)
|
194
137
|
access_web_object("text_field(locator).value", WebObjects::TextField, locator)
|
195
138
|
end
|
196
139
|
|
197
|
-
# Platform method to enter text into a text field object.
|
198
|
-
# @see Symbiont::Generators#text_field
|
199
140
|
def set_text_field_value_for(locator, value)
|
200
141
|
access_web_object("text_field(locator).set(value)", WebObjects::TextField, locator, value)
|
201
142
|
end
|
202
143
|
|
203
|
-
|
204
|
-
|
205
|
-
def
|
206
|
-
|
144
|
+
## Checkboxes ##
|
145
|
+
|
146
|
+
def checkbox_element(locator)
|
147
|
+
reference_web_object("checkbox(locator)", WebObjects::CheckBox, locator)
|
207
148
|
end
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
def check_text_field_for_visibility(locator)
|
212
|
-
access_web_object("text_field(locator).visible?", WebObjects::TextField, locator)
|
149
|
+
|
150
|
+
def check_checkbox_for_checked(locator)
|
151
|
+
access_web_object("checkbox(locator).set?", WebObjects::CheckBox, locator)
|
213
152
|
end
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
def check_text_field_for_enabled(locator)
|
218
|
-
access_web_object("text_field(locator).enabled?", WebObjects::TextField, locator)
|
153
|
+
|
154
|
+
def check_checkbox_for(locator)
|
155
|
+
access_web_object("checkbox(locator).set", WebObjects::CheckBox, locator)
|
219
156
|
end
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
157
|
+
|
158
|
+
def uncheck_checkbox_for(locator)
|
159
|
+
access_web_object("checkbox(locator).clear", WebObjects::CheckBox, locator)
|
160
|
+
end
|
161
|
+
|
162
|
+
## Select Lists ##
|
163
|
+
|
164
|
+
def select_list_element(locator)
|
225
165
|
reference_web_object("select_list(locator)", WebObjects::SelectList, locator)
|
226
166
|
end
|
227
167
|
|
228
|
-
# Platform method to retrieve the text of the current selection from a select list object.
|
229
|
-
# @see Symbiont::Generators#select_list
|
230
168
|
def get_select_list_item_for(locator)
|
231
169
|
access_web_object("select_list(locator).selected_options[0].text", WebObjects::SelectList, locator)
|
232
170
|
end
|
233
171
|
|
234
|
-
# Platform method to retrieve the value of the current selection from a select list object.
|
235
|
-
# @see Symbiont::Generators#select_list
|
236
172
|
def get_select_list_value_for(locator)
|
237
173
|
access_web_object("select_list(locator).value", WebObjects::SelectList, locator)
|
238
174
|
end
|
239
175
|
|
240
|
-
# Platform method to set the value of a select list object.
|
241
|
-
# @see Symbiont::Generators#select_list
|
242
176
|
def set_select_list_value_for(locator, value)
|
243
177
|
access_web_object("select_list(locator).select(value)", WebObjects::SelectList, locator, value)
|
244
178
|
end
|
245
179
|
|
246
|
-
|
247
|
-
|
248
|
-
def
|
249
|
-
access_web_object("select_list(locator).exists?", WebObjects::SelectList, locator)
|
250
|
-
end
|
251
|
-
|
252
|
-
# Platform method to check if select list object is visible.
|
253
|
-
# @see Symbiont::Generators#select_list
|
254
|
-
def check_select_list_for_visibility(locator)
|
255
|
-
access_web_object("select_list(locator).visible?", WebObjects::SelectList, locator)
|
256
|
-
end
|
257
|
-
|
258
|
-
# Platform method to check if select list object is enabled.
|
259
|
-
# @see Symbiont::Generators#select_list
|
260
|
-
def check_select_list_for_enabled(locator)
|
261
|
-
access_web_object("select_list(locator).enabled?", WebObjects::SelectList, locator)
|
262
|
-
end
|
263
|
-
|
264
|
-
# Platform method to return a checkbox object.
|
265
|
-
# Checkbox objects are of type: Symbiont::WebObjects::CheckBox
|
266
|
-
# @see Symbiont::Generators#checkbox
|
267
|
-
def get_checkbox_for(locator)
|
268
|
-
reference_web_object("checkbox(locator)", WebObjects::CheckBox, locator)
|
269
|
-
end
|
270
|
-
|
271
|
-
# Platform method to check if checkbox object exists.
|
272
|
-
# @see Symbiont::Generators#checkbox
|
273
|
-
def check_checkbox_for_existence(locator)
|
274
|
-
access_web_object("checkbox(locator).exists?", WebObjects::CheckBox, locator)
|
275
|
-
end
|
276
|
-
|
277
|
-
# Platform method to check if checkbox object is visible.
|
278
|
-
# @see Symbiont::Generators#checkbox
|
279
|
-
def check_checkbox_for_visibility(locator)
|
280
|
-
access_web_object("checkbox(locator).visible?", WebObjects::CheckBox, locator)
|
281
|
-
end
|
282
|
-
|
283
|
-
# Platform method to check if checkbox object is enabled.
|
284
|
-
# @see Symbiont::Generators#checkbox
|
285
|
-
def check_checkbox_for_enabled(locator)
|
286
|
-
access_web_object("checkbox(locator).enabled?", WebObjects::CheckBox, locator)
|
287
|
-
end
|
288
|
-
|
289
|
-
# Platform method to determine if a checkbox is checked.
|
290
|
-
# @see Symbiont::Generators#checkbox
|
291
|
-
def check_checkbox_for_checked(locator)
|
292
|
-
access_web_object("checkbox(locator).set?", WebObjects::CheckBox, locator)
|
293
|
-
end
|
294
|
-
|
295
|
-
# Platform method to check a checkbox object.
|
296
|
-
# @see Symbiont::Generators#checkbox
|
297
|
-
def check_checkbox_for(locator)
|
298
|
-
access_web_object("checkbox(locator).set", WebObjects::CheckBox, locator)
|
299
|
-
end
|
300
|
-
|
301
|
-
# Platform method to uncheck a checkbox object.
|
302
|
-
# @see Symbiont::Generators#checkbox
|
303
|
-
def uncheck_checkbox_for(locator)
|
304
|
-
access_web_object("checkbox(locator).clear", WebObjects::CheckBox, locator)
|
305
|
-
end
|
306
|
-
|
307
|
-
# Platform method to return a radio object.
|
308
|
-
# Radio objects are of type: Symbiont::WebObjects::Radio
|
309
|
-
# @see Symbiont::Generators#radio
|
310
|
-
def get_radio_for(locator)
|
180
|
+
## Radios ##
|
181
|
+
|
182
|
+
def radio_element(locator)
|
311
183
|
reference_web_object("radio(locator)", WebObjects::Radio, locator)
|
312
184
|
end
|
313
185
|
|
314
|
-
# Platform method to check if radio object exists.
|
315
|
-
# @see Symbiont::Generators#radio
|
316
|
-
def check_radio_for_existence(locator)
|
317
|
-
access_web_object("radio(locator).exists?", WebObjects::Radio, locator)
|
318
|
-
end
|
319
|
-
|
320
|
-
# Platform method to check if radio object is visible.
|
321
|
-
# @see Symbiont::Generators#radio
|
322
|
-
def check_radio_for_visibility(locator)
|
323
|
-
access_web_object("radio(locator).visible?", WebObjects::Radio, locator)
|
324
|
-
end
|
325
|
-
|
326
|
-
# Platform method to check if radio object is enabled.
|
327
|
-
# @see Symbiont::Generators#radio
|
328
|
-
def check_radio_for_enabled(locator)
|
329
|
-
access_web_object("radio(locator).enabled?", WebObjects::Radio, locator)
|
330
|
-
end
|
331
|
-
|
332
|
-
# Platform method to determine if a radio is selected.
|
333
|
-
# @see Symbiont::Generators#radio
|
334
186
|
def check_radio_for_selected(locator)
|
335
187
|
access_web_object("radio(locator).set?", WebObjects::Radio, locator)
|
336
188
|
end
|
337
189
|
|
338
|
-
# Platform method to select a radio object.
|
339
|
-
# @see Symbiont::Generators#radio
|
340
190
|
def select_radio_for(locator)
|
341
191
|
access_web_object("radio(locator).set", WebObjects::Radio, locator)
|
342
192
|
end
|
193
|
+
|
194
|
+
|
195
|
+
|
343
196
|
|
344
197
|
# Platform method to return a table object.
|
345
198
|
# Table objects are of type: Symbiont::WebObjects::Table
|
@@ -350,15 +203,15 @@ module Symbiont
|
|
350
203
|
|
351
204
|
# Platform method to check if table object exists.
|
352
205
|
# @see Symbiont::Generators#table
|
353
|
-
def check_table_for_existence(locator)
|
354
|
-
|
355
|
-
end
|
206
|
+
#def check_table_for_existence(locator)
|
207
|
+
# access_web_object("table(locator).exists?", WebObjects::Table, locator)
|
208
|
+
#end
|
356
209
|
|
357
210
|
# Platform method to check if table object is visible.
|
358
211
|
# @see Symbiont::Generators#table
|
359
|
-
def check_table_for_visibility(locator)
|
360
|
-
|
361
|
-
end
|
212
|
+
#def check_table_for_visibility(locator)
|
213
|
+
# access_web_object("table(locator).visible?", WebObjects::Table, locator)
|
214
|
+
#end
|
362
215
|
|
363
216
|
# Platform method to return a table cell object.
|
364
217
|
# Table cell objects are of type: Symbiont::WebObjects::TableCell
|
@@ -369,15 +222,15 @@ module Symbiont
|
|
369
222
|
|
370
223
|
# Platform method to check if table cell object exists.
|
371
224
|
# @see Symbiont::Generators#cell
|
372
|
-
def check_table_cell_for_existence(locator)
|
373
|
-
|
374
|
-
end
|
225
|
+
#def check_table_cell_for_existence(locator)
|
226
|
+
# access_web_object("td(locator).exists?", WebObjects::TableCell, locator)
|
227
|
+
#end
|
375
228
|
|
376
229
|
# Platform method to check if table cell object is visible.
|
377
230
|
# @see Symbiont::Generators#cell
|
378
|
-
def check_table_cell_for_visibility(locator)
|
379
|
-
|
380
|
-
end
|
231
|
+
#def check_table_cell_for_visibility(locator)
|
232
|
+
# access_web_object("td(locator).visible?", WebObjects::TableCell, locator)
|
233
|
+
#end
|
381
234
|
|
382
235
|
# Platform method to get text of table cell object.
|
383
236
|
# @see Symbiont::Generators#cell
|
@@ -385,56 +238,16 @@ module Symbiont
|
|
385
238
|
access_web_object("td(locator).text", WebObjects::TableCell, locator)
|
386
239
|
end
|
387
240
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
def get_div_for(locator)
|
241
|
+
|
242
|
+
|
243
|
+
def div_element(locator)
|
392
244
|
reference_web_object("div(locator)", WebObjects::Div, locator)
|
393
245
|
end
|
394
|
-
|
395
|
-
|
396
|
-
# @see Symbiont::Generators#div
|
397
|
-
def check_div_for_existence(locator)
|
398
|
-
access_web_object("div(locator).exists?", WebObjects::Div, locator)
|
399
|
-
end
|
400
|
-
|
401
|
-
# Platform method to check if div object is visible.
|
402
|
-
# @see Symbiont::Generators#div
|
403
|
-
def check_div_for_visibility(locator)
|
404
|
-
access_web_object("div(locator).visible?", WebObjects::Div, locator)
|
405
|
-
end
|
406
|
-
|
407
|
-
# Platform method to get text of div object.
|
408
|
-
# @see Symbiont::Generators#div
|
409
|
-
def get_div_text_for(locator)
|
410
|
-
access_web_object("div(locator).text", WebObjects::Div, locator)
|
411
|
-
end
|
412
|
-
|
413
|
-
# Platform method to return a span object.
|
414
|
-
# Span objects are of type: Symbiont::WebObjects::Span
|
415
|
-
# @see Symbiont::Generators#span
|
416
|
-
def get_span_for(locator)
|
246
|
+
|
247
|
+
def span_element(locator)
|
417
248
|
reference_web_object("span(locator)", WebObjects::Span, locator)
|
418
249
|
end
|
419
|
-
|
420
|
-
# Platform method to check if span object exists.
|
421
|
-
# @see Symbiont::Generators#span
|
422
|
-
def check_span_for_existence(locator)
|
423
|
-
access_web_object("span(locator).exists?", WebObjects::Span, locator)
|
424
|
-
end
|
425
|
-
|
426
|
-
# Platform method to check if span object is visible.
|
427
|
-
# @see Symbiont::Generators#span
|
428
|
-
def check_span_for_visibility(locator)
|
429
|
-
access_web_object("span(locator).visible?", WebObjects::Span, locator)
|
430
|
-
end
|
431
|
-
|
432
|
-
# Platform method to get text of span object.
|
433
|
-
# @see Symbiont::Generators#span
|
434
|
-
def get_span_text_for(locator)
|
435
|
-
access_web_object("span(locator).text", WebObjects::Span, locator)
|
436
|
-
end
|
437
|
-
|
250
|
+
|
438
251
|
private
|
439
252
|
|
440
253
|
# This method is called by any platform methods that require getting
|
@@ -446,9 +259,10 @@ module Symbiont
|
|
446
259
|
# @return [Object] the web object identified by the action
|
447
260
|
def reference_web_object(action, object_type, locator)
|
448
261
|
enclosers = locator.delete(:frame)
|
449
|
-
locator = object_type.
|
262
|
+
locator = object_type.provide_watir_locator_for(locator)
|
450
263
|
web_object = @browser.instance_eval "#{enclosed_by(enclosers)}#{action}"
|
451
|
-
|
264
|
+
@browser.wd.switch_to.default_content unless enclosers.nil?
|
265
|
+
object_type.new(web_object, :platform => :watir_webdriver)
|
452
266
|
end
|
453
267
|
|
454
268
|
# This method is called by any platform methods that require accessing
|
@@ -462,12 +276,10 @@ module Symbiont
|
|
462
276
|
# @return [Any] the information or object returned by the action
|
463
277
|
def access_web_object(action, object_type, locator, value=nil)
|
464
278
|
enclosers = locator.delete(:frame)
|
465
|
-
locator = object_type.
|
466
|
-
@browser.instance_eval "#{enclosed_by(enclosers)}#{action}"
|
467
|
-
|
468
|
-
|
469
|
-
def check_for_css(action, locator)
|
470
|
-
locator[:css] ? "element(locator)" : action
|
279
|
+
locator = object_type.provide_watir_locator_for(locator)
|
280
|
+
object = @browser.instance_eval "#{enclosed_by(enclosers)}#{action}"
|
281
|
+
@browser.wd.switch_to.default_content unless enclosers.nil?
|
282
|
+
object
|
471
283
|
end
|
472
284
|
|
473
285
|
# This method is used to wrap a web object locator within the locator for an
|