selenium-cucumber 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/canned_steps.md +337 -76
- data/doc/installation.md +13 -13
- data/features-skeleton/my_first.feature +5 -5
- data/features-skeleton/step_definitions/custom_steps.rb +3 -3
- data/features-skeleton/support/env.rb +37 -29
- data/lib/selenium-cucumber.rb +8 -7
- data/lib/selenium-cucumber/assertion_steps.rb +436 -57
- data/lib/selenium-cucumber/configuration_steps.rb +7 -0
- data/lib/selenium-cucumber/input_steps.rb +322 -0
- data/lib/selenium-cucumber/javascript_handling_steps.rb +9 -0
- data/lib/selenium-cucumber/methods/assertion_methods.rb +165 -34
- data/lib/selenium-cucumber/methods/configuration_methods.rb +9 -0
- data/lib/selenium-cucumber/methods/input_methods.rb +87 -0
- data/lib/selenium-cucumber/methods/javascript_handling_methods.rb +6 -0
- data/lib/selenium-cucumber/methods/navigate_methods.rb +75 -11
- data/lib/selenium-cucumber/methods/press_button_methods.rb +6 -6
- data/lib/selenium-cucumber/methods/progress_methods.rb +15 -6
- data/lib/selenium-cucumber/methods/screenshot_methods.rb +7 -0
- data/lib/selenium-cucumber/navigation_steps.rb +104 -9
- data/lib/selenium-cucumber/press_button_steps.rb +37 -13
- data/lib/selenium-cucumber/progress_steps.rb +58 -0
- data/lib/selenium-cucumber/screenshot_steps.rb +5 -0
- data/lib/selenium-cucumber/version.rb +1 -1
- metadata +19 -11
- data/lib/selenium-cucumber/enter_text_steps.rb +0 -27
- data/lib/selenium-cucumber/methods/enter_text_methods.rb +0 -14
- data/lib/selenium-cucumber/progress_step.rb +0 -17
- data/lib/selenium-cucumber/screenshot_step.rb +0 -8
@@ -0,0 +1,322 @@
|
|
1
|
+
require_relative 'methods/input_methods'
|
2
|
+
|
3
|
+
#enter text into input field steps
|
4
|
+
|
5
|
+
#By ID
|
6
|
+
Then(/^I enter "([^\"]*)" into input field having id "([^\"]*)"$/) do |text, access_name|
|
7
|
+
enter_text("id",text,access_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
#By NAME
|
11
|
+
Then(/^I enter "([^\"]*)" into input field having name "([^\"]*)"$/) do |text, access_name|
|
12
|
+
enter_text("name",text,access_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
#By CLASS
|
16
|
+
Then(/^I enter "([^\"]*)" into input field having class "([^\"]*)"$/) do |text, access_name|
|
17
|
+
enter_text("class",text,access_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
#By XPATH
|
21
|
+
Then(/^I enter "([^\"]*)" into input field having xpath "([^\"]*)"$/) do |text, access_name|
|
22
|
+
enter_text("xpath",text,access_name)
|
23
|
+
end
|
24
|
+
|
25
|
+
#By CSS
|
26
|
+
Then(/^I enter "([^\"]*)" into input field having css "([^\"]*)"$/) do |text, access_name|
|
27
|
+
enter_text("css",text,access_name)
|
28
|
+
end
|
29
|
+
|
30
|
+
#clear input field steps
|
31
|
+
|
32
|
+
#By ID
|
33
|
+
Then(/^I clear input field having id "([^\"]*)"$/) do |access_name|
|
34
|
+
clear_text("id",access_name)
|
35
|
+
end
|
36
|
+
|
37
|
+
#By NAME
|
38
|
+
Then(/^I clear input field having name "([^\"]*)"$/) do |access_name|
|
39
|
+
clear_text("name",access_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
#By CLASS
|
43
|
+
Then(/^I clear input field having class "([^\"]*)"$/) do |access_name|
|
44
|
+
clear_text("class",access_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
#By XPATH
|
48
|
+
Then(/^I clear input field having xpath "([^\"]*)"$/) do |access_name|
|
49
|
+
clear_text("xpath",access_name)
|
50
|
+
end
|
51
|
+
|
52
|
+
#By CSS
|
53
|
+
Then(/^I clear input field having css "([^\"]*)"$/) do |access_name|
|
54
|
+
clear_text("css",access_name)
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
#select option by text from Drop down list
|
59
|
+
#By TEXT
|
60
|
+
#By ID
|
61
|
+
Then(/^I select "(.*?)" option by text from dropdown having id "(.*?)"$/) do |option, access_name|
|
62
|
+
select_option_from_dropdown("id","text",option,access_name)
|
63
|
+
end
|
64
|
+
|
65
|
+
#By NAME
|
66
|
+
Then(/^I select "(.*?)" option by text from dropdown having name "(.*?)"$/) do |option, access_name|
|
67
|
+
select_option_from_dropdown("name","text",option,access_name)
|
68
|
+
end
|
69
|
+
|
70
|
+
#By CLASS
|
71
|
+
Then(/^I select "(.*?)" option by text from dropdown having class "(.*?)"$/) do |option, access_name|
|
72
|
+
select_option_from_dropdown("class","text",option,access_name)
|
73
|
+
end
|
74
|
+
|
75
|
+
#By XPATH
|
76
|
+
Then(/^I select "(.*?)" option by text from dropdown having xpath "(.*?)"$/) do |option, access_name|
|
77
|
+
select_option_from_dropdown("xpath","text",option,access_name)
|
78
|
+
end
|
79
|
+
|
80
|
+
#By CSS
|
81
|
+
Then(/^I select "(.*?)" option by text from dropdown having css "(.*?)"$/) do |option, access_name|
|
82
|
+
select_option_from_dropdown("css","text",option,access_name)
|
83
|
+
end
|
84
|
+
|
85
|
+
#select option by index from Drop down list
|
86
|
+
#By INDEX
|
87
|
+
#By ID
|
88
|
+
Then(/^I select (\d+) option by index from dropdown having id "(.*?)"$/) do |option, access_name|
|
89
|
+
select_option_from_dropdown("id","index",option,access_name)
|
90
|
+
end
|
91
|
+
|
92
|
+
#By NAME
|
93
|
+
Then(/^I select (\d+) option by index from dropdown having name "(.*?)"$/) do |option, access_name|
|
94
|
+
select_option_from_dropdown("name","index",option,access_name)
|
95
|
+
end
|
96
|
+
|
97
|
+
#By CLASS
|
98
|
+
Then(/^I select (\d+) option by index from dropdown having class "(.*?)"$/) do |option, access_name|
|
99
|
+
select_option_from_dropdown("class","index",option,access_name)
|
100
|
+
end
|
101
|
+
|
102
|
+
#By XPATH
|
103
|
+
Then(/^I select (\d+) option by index from dropdown having xpath "(.*?)"$/) do |option, access_name|
|
104
|
+
select_option_from_dropdown("xpath","index",option,access_name)
|
105
|
+
end
|
106
|
+
|
107
|
+
#By CSS
|
108
|
+
Then(/^I select (\d+) option by index from dropdown having css "(.*?)"$/) do |option, access_name|
|
109
|
+
select_option_from_dropdown("css","index",option,access_name)
|
110
|
+
end
|
111
|
+
|
112
|
+
#select option by value from Drop down list
|
113
|
+
#By VALUE
|
114
|
+
#By ID
|
115
|
+
Then(/^I select "(.*?)" option by value from dropdown having id "(.*?)"$/) do |option, access_name|
|
116
|
+
select_option_from_dropdown("id","value",option,access_name)
|
117
|
+
end
|
118
|
+
|
119
|
+
#By NAME
|
120
|
+
Then(/^I select "(.*?)" option by value from dropdown having name "(.*?)"$/) do |option, access_name|
|
121
|
+
select_option_from_dropdown("name","value",option,access_name)
|
122
|
+
end
|
123
|
+
|
124
|
+
#By CLASS
|
125
|
+
Then(/^I select "(.*?)" option by value from dropdown having class "(.*?)"$/) do |option, access_name|
|
126
|
+
select_option_from_dropdown("class","value",option,access_name)
|
127
|
+
end
|
128
|
+
|
129
|
+
#By XPATH
|
130
|
+
Then(/^I select "(.*?)" option by value from dropdown having xpath "(.*?)"$/) do |option, access_name|
|
131
|
+
select_option_from_dropdown("xpath","value",option,access_name)
|
132
|
+
end
|
133
|
+
|
134
|
+
#By CSS
|
135
|
+
Then(/^I select "(.*?)" option by value from dropdown having css "(.*?)"$/) do |option, access_name|
|
136
|
+
select_option_from_dropdown("css","value",option,access_name)
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
#unselect option from dropdown list
|
141
|
+
|
142
|
+
#By ID
|
143
|
+
Then(/^I unselect options from dropdown having id "(.*?)"$/) do |access_name|
|
144
|
+
unselect_option_from_dropdown("id", access_name)
|
145
|
+
end
|
146
|
+
|
147
|
+
#By NAME
|
148
|
+
Then(/^I unselect options from dropdown having name "(.*?)"$/) do |access_name|
|
149
|
+
unselect_option_from_dropdown("name", access_name)
|
150
|
+
end
|
151
|
+
|
152
|
+
#By CLASS
|
153
|
+
Then(/^I unselect options from dropdown having class "(.*?)"$/) do |access_name|
|
154
|
+
unselect_option_from_dropdown("class", access_name)
|
155
|
+
end
|
156
|
+
|
157
|
+
#By XPATH
|
158
|
+
Then(/^I unselect options from dropdown having xpath "(.*?)"$/) do |access_name|
|
159
|
+
unselect_option_from_dropdown("xpath", access_name)
|
160
|
+
end
|
161
|
+
|
162
|
+
#By CSS
|
163
|
+
Then(/^I unselect options from dropdown having css "(.*?)"$/) do |access_name|
|
164
|
+
unselect_option_from_dropdown("css", access_name)
|
165
|
+
end
|
166
|
+
|
167
|
+
#check checkbox steps
|
168
|
+
#By ID
|
169
|
+
Then(/^I check checkbox having id "(.*?)"$/) do |access_name|
|
170
|
+
check_checkbox("id",access_name)
|
171
|
+
end
|
172
|
+
|
173
|
+
#By NAME
|
174
|
+
Then(/^I check checkbox having name "(.*?)"$/) do |access_name|
|
175
|
+
check_checkbox("name",access_name)
|
176
|
+
end
|
177
|
+
|
178
|
+
#By CLASS
|
179
|
+
Then(/^I check checkbox having class "(.*?)"$/) do |access_name|
|
180
|
+
check_checkbox("class",access_name)
|
181
|
+
end
|
182
|
+
|
183
|
+
#By XPATH
|
184
|
+
Then(/^I check checkbox having xpath "(.*?)"$/) do |access_name|
|
185
|
+
check_checkbox("xpath",access_name)
|
186
|
+
end
|
187
|
+
|
188
|
+
#By CSS
|
189
|
+
Then(/^I check checkbox having css "(.*?)"$/) do |access_name|
|
190
|
+
check_checkbox("css",access_name)
|
191
|
+
end
|
192
|
+
|
193
|
+
#uncheck checkbox steps
|
194
|
+
#By ID
|
195
|
+
Then(/^I uncheck checkbox having id "(.*?)"$/) do |access_name|
|
196
|
+
uncheck_checkbox("id",access_name)
|
197
|
+
end
|
198
|
+
|
199
|
+
#By NAME
|
200
|
+
Then(/^I uncheck checkbox having name "(.*?)"$/) do |access_name|
|
201
|
+
uncheck_checkbox("name",access_name)
|
202
|
+
end
|
203
|
+
|
204
|
+
#By CLASS
|
205
|
+
Then(/^I uncheck checkbox having class "(.*?)"$/) do |access_name|
|
206
|
+
uncheck_checkbox("class",access_name)
|
207
|
+
end
|
208
|
+
|
209
|
+
#By XPATH
|
210
|
+
Then(/^I uncheck checkbox having xpath "(.*?)"$/) do |access_name|
|
211
|
+
uncheck_checkbox("xpath",access_name)
|
212
|
+
end
|
213
|
+
|
214
|
+
#By CSS
|
215
|
+
Then(/^I uncheck checkbox having css "(.*?)"$/) do |access_name|
|
216
|
+
uncheck_checkbox("css",access_name)
|
217
|
+
end
|
218
|
+
|
219
|
+
#Steps to toggle checkbox
|
220
|
+
#By ID
|
221
|
+
Then(/^toggle checkbox having id "(.*?)"$/) do |access_name|
|
222
|
+
toggle_checkbox("id",access_name)
|
223
|
+
end
|
224
|
+
|
225
|
+
#By NAME
|
226
|
+
Then(/^toggle checkbox having name "(.*?)"$/) do |access_name|
|
227
|
+
toggle_checkbox("name",access_name)
|
228
|
+
end
|
229
|
+
|
230
|
+
#By CLASS
|
231
|
+
Then(/^toggle checkbox having class "(.*?)"$/) do |access_name|
|
232
|
+
toggle_checkbox("class",access_name)
|
233
|
+
end
|
234
|
+
|
235
|
+
#By XPATH
|
236
|
+
Then(/^toggle checkbox having xpath "(.*?)"$/) do |access_name|
|
237
|
+
toggle_checkbox("xpath",access_name)
|
238
|
+
end
|
239
|
+
|
240
|
+
#By CSS
|
241
|
+
Then(/^toggle checkbox having css "(.*?)"$/) do |access_name|
|
242
|
+
toggle_checkbox("css",access_name)
|
243
|
+
end
|
244
|
+
|
245
|
+
#radio button select steps
|
246
|
+
#By ID
|
247
|
+
Then(/^I select radio button having id "(.*?)"$/) do |access_name|
|
248
|
+
select_radio_button("id",access_name)
|
249
|
+
end
|
250
|
+
|
251
|
+
#By NAME
|
252
|
+
Then(/^I select radio button having name "(.*?)"$/) do |access_name|
|
253
|
+
select_radio_button("name",access_name)
|
254
|
+
end
|
255
|
+
|
256
|
+
#By CLASS
|
257
|
+
Then(/^I select radio button having class "(.*?)"$/) do |access_name|
|
258
|
+
select_radio_button("class",access_name)
|
259
|
+
end
|
260
|
+
|
261
|
+
#By XPATH
|
262
|
+
Then(/^I select radio button having xpath "(.*?)"$/) do |access_name|
|
263
|
+
select_radio_button("xpath",access_name)
|
264
|
+
end
|
265
|
+
|
266
|
+
#By CSS
|
267
|
+
Then(/^I select radio button having css "(.*?)"$/) do |access_name|
|
268
|
+
select_radio_button("css",access_name)
|
269
|
+
end
|
270
|
+
|
271
|
+
|
272
|
+
#steps to select option by text from radio button group
|
273
|
+
#By ID
|
274
|
+
Then(/^I select "(.*?)" option by text from radio button group having id "(.*?)"$/) do |option, access_name|
|
275
|
+
select_option_from_radio_button_group("id","text",option,access_name)
|
276
|
+
end
|
277
|
+
|
278
|
+
#By NAME
|
279
|
+
Then(/^I select "(.*?)" option by text from radio button group having name "(.*?)"$/) do |option, access_name|
|
280
|
+
select_option_from_radio_button_group("name","text",option,access_name)
|
281
|
+
end
|
282
|
+
|
283
|
+
#By CLASS
|
284
|
+
Then(/^I select "(.*?)" option by text from radio button group having class "(.*?)"$/) do |option, access_name|
|
285
|
+
select_option_from_radio_button_group("class","text",option,access_name)
|
286
|
+
end
|
287
|
+
|
288
|
+
#By XPATH
|
289
|
+
Then(/^I select "(.*?)" option by text from radio button group having xpath "(.*?)"$/) do |option, access_name|
|
290
|
+
select_option_from_radio_button_group("xpath","text",option,access_name)
|
291
|
+
end
|
292
|
+
|
293
|
+
#By CSS
|
294
|
+
Then(/^I select "(.*?)" option by text from radio button group having css "(.*?)"$/) do |option, access_name|
|
295
|
+
select_option_from_radio_button_group("css","text",option,access_name)
|
296
|
+
end
|
297
|
+
|
298
|
+
#steps to select option by value from radio button group
|
299
|
+
#By ID
|
300
|
+
Then(/^I select "(.*?)" option by value from radio button group having id "(.*?)"$/) do |option, access_name|
|
301
|
+
select_option_from_radio_button_group("id","value",option,access_name)
|
302
|
+
end
|
303
|
+
|
304
|
+
#By NAME
|
305
|
+
Then(/^I select "(.*?)" option by value from radio button group having name "(.*?)"$/) do |option, access_name|
|
306
|
+
select_option_from_radio_button_group("name","value",option,access_name)
|
307
|
+
end
|
308
|
+
|
309
|
+
#By CLASS
|
310
|
+
Then(/^I select "(.*?)" option by value from radio button group having class "(.*?)"$/) do |option, access_name|
|
311
|
+
select_option_from_radio_button_group("class","value",option,access_name)
|
312
|
+
end
|
313
|
+
|
314
|
+
#By XPATH
|
315
|
+
Then(/^I select "(.*?)" option by value from radio button group having xpath "(.*?)"$/) do |option, access_name|
|
316
|
+
select_option_from_radio_button_group("xpath","value",option,access_name)
|
317
|
+
end
|
318
|
+
|
319
|
+
#By CSS
|
320
|
+
Then(/^I select "(.*?)" option by value from radio button group having css "(.*?)"$/) do |option, access_name|
|
321
|
+
select_option_from_radio_button_group("css","value",option,access_name)
|
322
|
+
end
|
@@ -1,35 +1,166 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require "selenium-webdriver"
|
3
|
-
|
4
|
-
#Page title checking
|
5
|
-
def check_title(title)
|
6
|
-
if($driver.title!=title)
|
7
|
-
raise "Page Title Not Matched"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
#
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require "selenium-webdriver"
|
3
|
+
|
4
|
+
#Page title checking
|
5
|
+
def check_title(title)
|
6
|
+
if($driver.title!=title)
|
7
|
+
raise "Page Title Not Matched"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
#Method to check element text
|
12
|
+
def check_element_text(access_type, actual_value, access_name, test_case)
|
13
|
+
puts $driver.find_element(:"#{access_type}" => "#{access_name}").text
|
14
|
+
|
15
|
+
if test_case
|
16
|
+
if($driver.find_element(:"#{access_type}" => "#{access_name}").text!=actual_value)
|
17
|
+
raise "Text Not Matched"
|
18
|
+
end
|
19
|
+
else
|
20
|
+
if($driver.find_element(:"#{access_type}" => "#{access_name}").text==actual_value)
|
21
|
+
raise "Text Matched"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
#Element enabled checking
|
27
|
+
def check_element_enable(access_type, access_name, test_case)
|
28
|
+
if test_case
|
29
|
+
if(!$driver.find_element(:"#{access_type}" => "#{access_name}").enabled?)
|
30
|
+
raise "Element not enabled"
|
31
|
+
end
|
32
|
+
else
|
33
|
+
if($driver.find_element(:"#{access_type}" => "#{access_name}").enabled?)
|
34
|
+
raise "Element enabled"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# method to check attribute value
|
40
|
+
def check_element_attribute(access_type, attribute_name , attribute_value, access_name, test_case)
|
41
|
+
puts $driver.find_element(:"#{access_type}" => "#{access_name}").attribute("#{attribute_name}")
|
42
|
+
if test_case
|
43
|
+
if($driver.find_element(:"#{access_type}" => "#{access_name}").attribute("#{attribute_name}")!=attribute_value)
|
44
|
+
raise "Attribute Not Matched"
|
45
|
+
end
|
46
|
+
else
|
47
|
+
if($driver.find_element(:"#{access_type}" => "#{access_name}").attribute("#{attribute_name}")==attribute_value)
|
48
|
+
raise "Attribute Matched"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# method to check element presence
|
54
|
+
def check_element_presence(access_type, access_name, test_case)
|
55
|
+
if test_case
|
56
|
+
if !$driver.find_element(:"#{access_type}" => "#{access_name}").displayed?
|
57
|
+
raise "Excpetion : Element Not Present"
|
58
|
+
else
|
59
|
+
puts $driver.find_element(:"#{access_type}" => "#{access_name}").text
|
60
|
+
end
|
61
|
+
else
|
62
|
+
begin
|
63
|
+
puts $driver.find_element(:"#{access_type}" => "#{access_name}").text
|
64
|
+
raise "present"
|
65
|
+
rescue Exception => e
|
66
|
+
if e.message=="present"
|
67
|
+
raise "Exception : Element Present"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
#method to assert checkbox check
|
74
|
+
def is_checkbox_checked(access_type, access_name)
|
75
|
+
checkbox = $driver.find_element(:"#{access_type}" => "#{access_name}")
|
76
|
+
|
77
|
+
if !checkbox.selected?
|
78
|
+
raise "Checkbox not checked"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
#method to assert checkbox uncheck
|
83
|
+
def is_checkbox_unchecked(access_type, access_name)
|
84
|
+
checkbox = $driver.find_element(:"#{access_type}" => "#{access_name}")
|
85
|
+
|
86
|
+
if checkbox.selected?
|
87
|
+
raise "Checkbox checked"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
#method to assert checkbox check
|
92
|
+
def is_radio_button_selected(access_type, access_name)
|
93
|
+
radio_button = $driver.find_element(:"#{access_type}" => "#{access_name}")
|
94
|
+
|
95
|
+
if !radio_button.selected?
|
96
|
+
raise "Radio button is not selected"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
#method to assert checkbox uncheck
|
101
|
+
def is_radio_button_unselected(access_type, access_name)
|
102
|
+
radio_button = $driver.find_element(:"#{access_type}" => "#{access_name}")
|
103
|
+
|
104
|
+
if radio_button.selected?
|
105
|
+
raise "Radio button is not selected"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
#method to assert option from radio button group is selected
|
111
|
+
def is_option_from_radio_button_group_selected(access_type, by, option, access_name)
|
112
|
+
radio_button_group = $driver.find_elements(:"#{access_type}" => "#{access_name}")
|
113
|
+
|
114
|
+
i=0
|
115
|
+
|
116
|
+
if by=="value"
|
117
|
+
while i<radio_button_group.length
|
118
|
+
if radio_button_group[i].attribute("value")==option
|
119
|
+
if !radio_button_group[i].selected?
|
120
|
+
raise "Radio button is not selected"
|
121
|
+
end
|
122
|
+
break
|
123
|
+
end
|
124
|
+
i=i+1
|
125
|
+
end
|
126
|
+
else
|
127
|
+
while i<radio_button_group.length
|
128
|
+
if radio_button_group[i].text==option
|
129
|
+
if !radio_button_group[i].selected?
|
130
|
+
raise "Radio button is not selected"
|
131
|
+
end
|
132
|
+
break
|
133
|
+
end
|
134
|
+
i=i+1
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
#method to assert option from radio button group is not selected
|
140
|
+
def is_option_from_radio_button_group_not_selected(access_type, by, option, access_name)
|
141
|
+
radio_button_group = $driver.find_elements(:"#{access_type}" => "#{access_name}")
|
142
|
+
|
143
|
+
i=0
|
144
|
+
|
145
|
+
if by=="value"
|
146
|
+
while i<radio_button_group.length
|
147
|
+
if radio_button_group[i].attribute("value")==option
|
148
|
+
if radio_button_group[i].selected?
|
149
|
+
raise "Radio button is selected"
|
150
|
+
end
|
151
|
+
break
|
152
|
+
end
|
153
|
+
i=i+1
|
154
|
+
end
|
155
|
+
else
|
156
|
+
while i<radio_button_group.length
|
157
|
+
if radio_button_group[i].text==option
|
158
|
+
if radio_button_group[i].selected?
|
159
|
+
raise "Radio button is selected"
|
160
|
+
end
|
161
|
+
break
|
162
|
+
end
|
163
|
+
i=i+1
|
164
|
+
end
|
165
|
+
end
|
35
166
|
end
|