awetestlib 0.1.22-x86-mingw32 → 0.1.23-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +7 -0
- data/lib/awetestlib/html_report.rb +15 -44
- data/lib/awetestlib/logging.rb +334 -374
- data/lib/awetestlib/regression/browser.rb +61 -71
- data/lib/awetestlib/regression/drag_and_drop.rb +31 -5
- data/lib/awetestlib/regression/find.rb +21 -139
- data/lib/awetestlib/regression/legacy.rb +1175 -1
- data/lib/awetestlib/regression/runner.rb +10 -6
- data/lib/awetestlib/regression/tables.rb +71 -25
- data/lib/awetestlib/regression/user_input.rb +88 -900
- data/lib/awetestlib/regression/utilities.rb +43 -18
- data/lib/awetestlib/regression/validations.rb +165 -248
- data/lib/awetestlib/regression/waits.rb +180 -94
- data/lib/awetestlib/runner.rb +1 -0
- data/lib/awetestlib.rb +3 -1
- data/lib/version.rb +2 -2
- data/test/create_zoho_account1.rb +1 -1
- data/test/login.xls +0 -0
- data/test/login_1.rb +37 -0
- data/test/login_1a.rb +37 -0
- data/test/login_2.rb +32 -0
- data/test/zoho_exercise.rb +21 -0
- metadata +10 -4
@@ -1,11 +1,1185 @@
|
|
1
1
|
module Awetestlib
|
2
2
|
module Regression
|
3
3
|
# Backward compatible methods and alias to support earlier versions of the Awetest DSL.
|
4
|
-
# These are deprecated in favor of the
|
4
|
+
# These are deprecated in favor of the methods actually called within them.
|
5
5
|
# Work in Progress
|
6
6
|
module Legacy
|
7
7
|
|
8
|
+
# @!group Click (UserInput)
|
8
9
|
|
10
|
+
# Click a button element identified by the value of its *:id* attribute. A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
11
|
+
# @param [Watir::Browser, Watir::Container] browser A reference to the browser window or container element to be tested.
|
12
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
13
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
14
|
+
# @return [Boolean] True if the Watir or Watir-webdriver function does not throw an exception.
|
15
|
+
def click_button_by_id(browser, what, desc = '')
|
16
|
+
click(browser, :button, :id, what, desc)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Click a button element identified by the value of its index within the container referred to by <b>*browser*</b>.
|
20
|
+
# @param (see #click_button_by_id)
|
21
|
+
# @return (see #click_button_by_id)
|
22
|
+
def click_link_by_index(browser, what, desc = '')
|
23
|
+
click(browser, :link, :index, what, desc)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Click a link element identified by the value of its *:href* attribute. Take care to escape characters in the url that are reserved by Regexp.
|
27
|
+
# @param (see #click_button_by_id)
|
28
|
+
# @return (see #click_button_by_id)
|
29
|
+
def click_link_by_href(browser, what, desc = '')
|
30
|
+
click(browser, :link, :href, what, desc)
|
31
|
+
end
|
32
|
+
|
33
|
+
alias click_href click_link_by_href
|
34
|
+
|
35
|
+
# Click a button element identified by the value of its index within the container referred to by <b>*browser*</b>.
|
36
|
+
# @param (see #click_link_by_index)
|
37
|
+
# @return (see #click_button_by_id)
|
38
|
+
def click_button_by_index(browser, what, desc = '')
|
39
|
+
click(browser, :button, :index, what, desc)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Click a button element identified by the value of its *:name* attribute. A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
43
|
+
# @param (see #click_button_by_id)
|
44
|
+
# @return (see #click_button_by_id)
|
45
|
+
def click_button_by_name(browser, what, desc = '')
|
46
|
+
click(browser, :button, :name, what, desc)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Click a button element identified by the value of its *:text* attribute. A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
50
|
+
# @param (see #click_button_by_id)
|
51
|
+
# @return (see #click_button_by_id)
|
52
|
+
def click_button_by_text(browser, what, desc = '')
|
53
|
+
click(browser, :button, :text, what, desc)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Click a button element identified by the value of its *:class* attribute. A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
57
|
+
# @param (see #click_button_by_id)
|
58
|
+
# @return (see #click_button_by_id)
|
59
|
+
def click_button_by_class(browser, what, desc = '')
|
60
|
+
click(browser, :button, :class, what, desc)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Click a button element identified by the value of its *:value* attribute. A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
64
|
+
# @param (see #click_button_by_id)
|
65
|
+
# @return (see #click_button_by_id)
|
66
|
+
def click_button_by_value(browser, what, desc = '')
|
67
|
+
click(browser, :button, :value, what, desc)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Click a button element identified by the value of its *:title* attribute. A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
71
|
+
# @param (see #click_button_by_id)
|
72
|
+
# @return (see #click_button_by_id)
|
73
|
+
def click_button_by_title(browser, what, desc = '')
|
74
|
+
click(browser, :button, :title, what, desc)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Click a link element identified by the value of its *:id* attribute.
|
78
|
+
# @param (see #click_button_by_id)
|
79
|
+
# @return (see #click_button_by_id)
|
80
|
+
def click_link_by_id(browser, what, desc = '')
|
81
|
+
click(browser, :link, :id, what, desc)
|
82
|
+
end
|
83
|
+
|
84
|
+
alias click_id click_link_by_id
|
85
|
+
|
86
|
+
# Click a link element identified by the value of its *:name* attribute.
|
87
|
+
# @param (see #click_button_by_id)
|
88
|
+
# @return (see #click_button_by_id)
|
89
|
+
def click_link_by_name(browser, what, desc = '')
|
90
|
+
click(browser, :link, :name, what, desc)
|
91
|
+
end
|
92
|
+
|
93
|
+
alias click_name click_link_by_name
|
94
|
+
|
95
|
+
# Click a file_field element identified by the value of its *:id* attribute.
|
96
|
+
# @param (see #click_button_by_id)
|
97
|
+
# @return (see #click_button_by_id)
|
98
|
+
def click_file_field_by_id(browser, what, desc = '')
|
99
|
+
click(browser, :file_field, :id, what, desc)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Click an image element identified by the value of its *:id* attribute.
|
103
|
+
# @param (see #click_button_by_id)
|
104
|
+
# @return (see #click_button_by_id)
|
105
|
+
def click_img_by_alt(browser, what, desc = '')
|
106
|
+
click(browser, :image, :alt, what, desc)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Click an image element identified by the value of its *:title* attribute.
|
110
|
+
# @param (see #click_button_by_id)
|
111
|
+
# @return (see #click_button_by_id)
|
112
|
+
def click_img_by_title(browser, what, desc = '')
|
113
|
+
click(browser, :image, :title, what, desc)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Click an image element identified by the value of its *:src* attribute.
|
117
|
+
# Take care to escape characters in the source url that are reserved by Regexp.
|
118
|
+
# @param (see #click_button_by_id)
|
119
|
+
# @return (see #click_button_by_id)
|
120
|
+
def click_img_by_src(browser, what, desc = '')
|
121
|
+
click(browser, :image, :src, what, desc)
|
122
|
+
end
|
123
|
+
|
124
|
+
def click_js(browser, element, how, what, desc = '')
|
125
|
+
click(browser, element, how, what, desc)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Click a link element identified by the value of its *:value* attribute.
|
129
|
+
# @param (see #click_button_by_id)
|
130
|
+
# @return (see #click_button_by_id)
|
131
|
+
def click_link_by_value(browser, what, desc = '')
|
132
|
+
click(browser, :link, :value, what, desc)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Click a link element identified by the value in its text (innerHTML).
|
136
|
+
# @param (see #click_button_by_id)
|
137
|
+
# @return (see #click_button_by_id)
|
138
|
+
def click_link_by_text(browser, what, desc = '')
|
139
|
+
click(browser, :link, :text, what, desc)
|
140
|
+
end
|
141
|
+
|
142
|
+
alias click_link click_link_by_text
|
143
|
+
alias click_text click_link_by_text
|
144
|
+
alias click_js_button click_link_by_text
|
145
|
+
|
146
|
+
# Click a link element identified by the value of its *:class* attribute.
|
147
|
+
# @param (see #click_button_by_id)
|
148
|
+
# @return (see #click_button_by_id)
|
149
|
+
def click_link_by_class(browser, what, desc = '')
|
150
|
+
click(browser, :link, :class, what, desc)
|
151
|
+
end
|
152
|
+
|
153
|
+
alias click_class click_link_by_class
|
154
|
+
|
155
|
+
# Click a span element identified by the value in its text (innerHTML).
|
156
|
+
# @param (see #click_button_by_id)
|
157
|
+
# @return (see #click_button_by_id)
|
158
|
+
def click_span_by_text(browser, what, desc = '')
|
159
|
+
click(browser, :span, :text, what, desc)
|
160
|
+
end
|
161
|
+
|
162
|
+
alias click_span_with_text click_span_by_text
|
163
|
+
|
164
|
+
# Click a link element identified by the value of its *:title* attribute.
|
165
|
+
# @param (see #click_button_by_id)
|
166
|
+
# @return (see #click_button_by_id)
|
167
|
+
def click_link_by_title(browser, what, desc = '')
|
168
|
+
click(browser, :link, :title, what, desc)
|
169
|
+
end
|
170
|
+
|
171
|
+
alias click_title click_link_by_title
|
172
|
+
|
173
|
+
# @!endgroup Click
|
174
|
+
|
175
|
+
# @!group Click No Wait (UserInput)
|
176
|
+
|
177
|
+
# Click a button element identified by the value of its *:id* attribute
|
178
|
+
# and do not wait for the browser to reach ready state.
|
179
|
+
# @param (see #click_button_by_id)
|
180
|
+
# @return (see #click_button_by_id)
|
181
|
+
def click_button_no_wait_by_id(browser, what, desc = '')
|
182
|
+
click_no_wait(browser, :button, :id, what, desc)
|
183
|
+
end
|
184
|
+
|
185
|
+
alias click_button_by_id_no_wait click_button_no_wait_by_id
|
186
|
+
|
187
|
+
# Click a button element identified by the value of its *:name* attribute
|
188
|
+
# and do not wait for the browser to reach ready state.
|
189
|
+
# @param (see #click_button_by_id)
|
190
|
+
# @return (see #click_button_by_id)
|
191
|
+
def click_button_no_wait_by_name(browser, what, desc = '')
|
192
|
+
click_no_wait(browser, :button, :name, what, desc)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Click a button element identified by the value of its *:class* attribute
|
196
|
+
# and do not wait for the browser to reach ready state.
|
197
|
+
# @param (see #click_button_by_id)
|
198
|
+
# @return (see #click_button_by_id)
|
199
|
+
def click_button_no_wait_by_class(browser, what, desc = '')
|
200
|
+
click_no_wait(browser, :button, :class, what, desc)
|
201
|
+
end
|
202
|
+
|
203
|
+
alias click_button_by_class_no_wait click_button_no_wait_by_class
|
204
|
+
|
205
|
+
# Click a link element identified by the value of its *:id* attribute
|
206
|
+
# and do not wait for the browser to reach ready state.
|
207
|
+
# @param (see #click_button_by_id)
|
208
|
+
# @return (see #click_button_by_id)
|
209
|
+
def click_link_no_wait_by_id(browser, what, desc = '')
|
210
|
+
click_no_wait(browser, :link, :id, what, desc)
|
211
|
+
end
|
212
|
+
|
213
|
+
alias click_no_wait_id click_link_no_wait_by_id
|
214
|
+
alias click_no_wait_by_id click_link_no_wait_by_id
|
215
|
+
alias click_id_no_wait click_link_no_wait_by_id
|
216
|
+
alias click_no_wait_link_by_id click_link_no_wait_by_id
|
217
|
+
|
218
|
+
# Click an image element identified by the value of its *:alt* attribute
|
219
|
+
# and do not wait for the browser to reach ready state.
|
220
|
+
# @param (see #click_button_by_id)
|
221
|
+
# @return (see #click_button_by_id)
|
222
|
+
def click_img_no_wait_by_alt(browser, what, desc = '')
|
223
|
+
click_no_wait(browser, :image, :alt, what, desc)
|
224
|
+
end
|
225
|
+
|
226
|
+
alias click_img_by_alt_no_wait click_img_no_wait_by_alt
|
227
|
+
|
228
|
+
# Click a button element identified by the value in its text (innerHTML)
|
229
|
+
# and do not wait for the browser to reach ready state.
|
230
|
+
# @param (see #click_button_by_id)
|
231
|
+
# @return (see #click_button_by_id)
|
232
|
+
def click_button_no_wait_by_text(browser, what, desc = '')
|
233
|
+
click_no_wait(browser, :button, :text, what, desc)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Click a button element identified by the value of its *:value* attribute
|
237
|
+
# and do not wait for the browser to reach ready state.
|
238
|
+
# @param (see #click_button_by_id)
|
239
|
+
# @return (see #click_button_by_id)
|
240
|
+
def click_button_no_wait_by_value(browser, what, desc = '')
|
241
|
+
click_no_wait(browser, :button, :value, what, desc)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Click a button element identified by the value of its *:name* attribute
|
245
|
+
# and do not wait for the browser to reach ready state.
|
246
|
+
# @param (see #click_button_by_id)
|
247
|
+
# @return (see #click_button_by_id)
|
248
|
+
def click_link_by_name_no_wait(browser, what, desc = '')
|
249
|
+
click_no_wait(browser, :link, :name, what, desc)
|
250
|
+
end
|
251
|
+
|
252
|
+
alias click_no_wait_name click_link_by_name_no_wait
|
253
|
+
alias click_name_no_wait click_link_by_name_no_wait
|
254
|
+
|
255
|
+
# Click a link element identified by the value in its text (innerHTML)
|
256
|
+
# and do not wait for the browser to reach ready state.
|
257
|
+
# @param (see #click_button_by_id)
|
258
|
+
# @return (see #click_button_by_id)
|
259
|
+
def click_link_by_text_no_wait(browser, what, desc = '')
|
260
|
+
click_no_wait(browser, :link, :text, what, desc)
|
261
|
+
end
|
262
|
+
|
263
|
+
alias click_no_wait_text click_link_by_text_no_wait
|
264
|
+
alias click_text_no_wait click_link_by_text_no_wait
|
265
|
+
|
266
|
+
# Click a link element identified by the value of its *:title* attribute
|
267
|
+
# and do not wait for the browser to reach ready state.
|
268
|
+
# @param (see #click_button_by_id)
|
269
|
+
# @return (see #click_button_by_id)
|
270
|
+
def click_title_no_wait(browser, what, desc = '')
|
271
|
+
click_no_wait(browser, :link, :title, what, desc)
|
272
|
+
end
|
273
|
+
|
274
|
+
# Click a link element identified by the value of its *:href* attribute and do not wait for the browser to reach ready state.
|
275
|
+
# Take care to escape characters in the url that are reserved by Regexp.
|
276
|
+
# @param (see #click_button_by_id)
|
277
|
+
# @return (see #click_button_by_id)
|
278
|
+
def click_link_no_wait_by_href(browser, what, desc = '')
|
279
|
+
click_no_wait(browser, :link, :href, what, desc)
|
280
|
+
end
|
281
|
+
|
282
|
+
alias click_href_no_wait click_link_no_wait_by_href
|
283
|
+
|
284
|
+
# @!endgroup Click No Wait
|
285
|
+
|
286
|
+
# @!group Xpath (UserInput)
|
287
|
+
|
288
|
+
# Click a button element identified by the value of its *:id* attribute using the xpath functionality in Watir.
|
289
|
+
# A button is an HTML element with tag 'input' and type 'submit' or 'button'.
|
290
|
+
# @note Normally used only when the element is not located by other methods.
|
291
|
+
# @param (see #click_button_by_id)
|
292
|
+
# @return (see #click_button_by_id)
|
293
|
+
def click_button_by_xpath_and_id(browser, what, desc = '')
|
294
|
+
click(browser, :button, :xpath, "//a[@id = '#{what}']", desc)
|
295
|
+
end
|
296
|
+
|
297
|
+
alias click_button_by_xpath click_button_by_xpath_and_id
|
298
|
+
|
299
|
+
# Click a link element identified by the value of its *:id* attribute using the xpath functionality in Watir.
|
300
|
+
# @note Normally used only when the element is not located by other methods.
|
301
|
+
# @param (see #click_button_by_id)
|
302
|
+
# @return (see #click_button_by_id)
|
303
|
+
def click_link_by_xpath_and_id(browser, what, desc = '')
|
304
|
+
click(browser, :link, :xpath, "//a[@id = '#{what}']", desc)
|
305
|
+
end
|
306
|
+
|
307
|
+
alias click_link_by_xpath click_link_by_xpath_and_id
|
308
|
+
|
309
|
+
# Click an image element identified by the value of its *:name* attribute using the xpath functionality in Watir.
|
310
|
+
# @note Normally used only when the element is not located by other methods.
|
311
|
+
# @param (see #click_button_by_id)
|
312
|
+
# @return (see #click_button_by_id)
|
313
|
+
def click_img_by_xpath_and_name(browser, what, desc = '')
|
314
|
+
click(browser, :image, :xpath, "//a[@id = '#{what}']", desc)
|
315
|
+
end
|
316
|
+
|
317
|
+
alias click_img_by_xpath click_img_by_xpath_and_name
|
318
|
+
alias click_image_by_xpath click_img_by_xpath_and_name
|
319
|
+
alias click_image_by_xpath_and_name click_img_by_xpath_and_name
|
320
|
+
|
321
|
+
# @!endgroup Xpath
|
322
|
+
|
323
|
+
# @!group Tables (UserInput)
|
324
|
+
|
325
|
+
# Click the first row which contains a particular string in a table identified by the value in its *:id* attribute.
|
326
|
+
#
|
327
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
328
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
329
|
+
# @param [String] text Full text string to be found in the table row.
|
330
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
331
|
+
# @param [Fixnum] column Integer indicating the column to search for the text string.
|
332
|
+
# If not supplied all columns will be checked.
|
333
|
+
# @return (see #click_button_by_id)
|
334
|
+
#
|
335
|
+
def click_table_row_with_text_by_id(browser, what, text, desc = '', column = nil)
|
336
|
+
click_table_row_with_text(browser, :id, what, text, desc, column)
|
337
|
+
end
|
338
|
+
|
339
|
+
# Click the first row which contains a particular string in a table identified by its index
|
340
|
+
# in the array of tables contained in <b>*browser*</b>.
|
341
|
+
# A specific column in the table can also be specified.
|
342
|
+
#
|
343
|
+
# @param (see #click_table_row_with_text_by_id)
|
344
|
+
# @return (see #click_button_by_id)
|
345
|
+
#
|
346
|
+
def click_table_row_with_text_by_index(browser, what, text, desc = '', column = nil)
|
347
|
+
click_table_row_with_text(browser, :id, what, text, desc, column)
|
348
|
+
end
|
349
|
+
|
350
|
+
# Double click the first row which contains a particular string in a table identified by the value in its *:id* attribute.
|
351
|
+
# A specific column in the table can also be specified.
|
352
|
+
#
|
353
|
+
# @param (see #click_table_row_with_text_by_id)
|
354
|
+
# @return (see #click_button_by_id)
|
355
|
+
#
|
356
|
+
def double_click_table_row_with_text_by_id(browser, what, text, desc = '', column = nil)
|
357
|
+
double_click_table_row_with_text(browser, :id, what, text, desc, column)
|
358
|
+
end
|
359
|
+
|
360
|
+
# Double click the first row which contains a particular string in a table identified by its index
|
361
|
+
# in the array of tables contained in <b>*browser*</b>.
|
362
|
+
# A specific column in the table can also be specified.
|
363
|
+
# @param (see #click_table_row_with_text_by_id)
|
364
|
+
# @return (see #click_button_by_id)
|
365
|
+
#
|
366
|
+
def double_click_table_row_with_text_by_index(browser, what, text, desc = '', column = nil)
|
367
|
+
double_click_table_row_with_text(browser, :index, what, text, desc, column)
|
368
|
+
end
|
369
|
+
|
370
|
+
# @!endgroup Tables
|
371
|
+
|
372
|
+
# @!group Select (UserInput)
|
373
|
+
|
374
|
+
# Select option from select list (dropdown) identified by the value in its *:id* attribute. Option is identified by *which* and *value*
|
375
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
376
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
377
|
+
# @param [String/Rexexp] option A string or regular expression that will uniquely identify the option to select.
|
378
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
379
|
+
# @param [Boolean] nofail If true do not log a failed message if the option is not found in the select list.
|
380
|
+
# @return (see #click_button_by_id)
|
381
|
+
def select_option_by_id_and_option_text(browser, what, option, nofail = false, desc = '')
|
382
|
+
select_option(browser, :id, what, :text, option, desc, nofail)
|
383
|
+
end
|
384
|
+
|
385
|
+
alias select_option_by_id select_option_by_id_and_option_text
|
386
|
+
alias select_option_by_id_and_text select_option_by_id_and_option_text
|
387
|
+
|
388
|
+
# Select option from select list (dropdown) identified by the value in its *:name* attribute. Option is selected by its *:text* attribute.
|
389
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
390
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
391
|
+
# @param [String/Rexexp] option A string or regular expression that will uniquely identify the option to select.
|
392
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
393
|
+
# @return (see #click_button_by_id)
|
394
|
+
def select_option_by_name_and_option_text(browser, what, option, desc = '')
|
395
|
+
select_option(browser, :name, what, :text, option, desc)
|
396
|
+
end
|
397
|
+
|
398
|
+
alias select_option_by_name select_option_by_name_and_option_text
|
399
|
+
|
400
|
+
# Select option from select list (dropdown) identified by the value in its *:name* attribute. Option is selected by its *:text* attribute.
|
401
|
+
# @param (see #select_option_by_name_and_option_text)
|
402
|
+
# @return (see #click_button_by_id)
|
403
|
+
def select_option_by_title_and_option_text(browser, what, option, desc = '')
|
404
|
+
select_option(browser, :title, what, :text, option, desc)
|
405
|
+
end
|
406
|
+
|
407
|
+
# Select option from select list (dropdown) identified by the value in its *:class* attribute. Option is selected by its *:text* attribute.
|
408
|
+
# @param (see #select_option_by_name_and_option_text)
|
409
|
+
# @return (see #click_button_by_id)
|
410
|
+
def select_option_by_class_and_option_text(browser, what, option, desc = '')
|
411
|
+
select_option(browser, :class, what, :text, option, desc)
|
412
|
+
end
|
413
|
+
|
414
|
+
# Select option from select list (dropdown) identified by the value in its *:name* attribute. Option is selected by its *:value* attribute.
|
415
|
+
# @param (see #select_option_by_name_and_option_text)
|
416
|
+
# @return (see #click_button_by_id)
|
417
|
+
def select_option_by_name_and_option_value(browser, what, option, desc = '')
|
418
|
+
select_option(browser, :name, what, :value, option, desc)
|
419
|
+
end
|
420
|
+
|
421
|
+
# Select option from select list (dropdown) identified by the value in its *:id* attribute. Option is selected by its *:value* attribute.
|
422
|
+
# @param (see #select_option_by_name_and_option_text)
|
423
|
+
# @return (see #click_button_by_id)
|
424
|
+
def select_option_by_id_and_option_value(browser, what, option, desc = '')
|
425
|
+
select_option(browser, :id, what, :value, option, desc)
|
426
|
+
end
|
427
|
+
|
428
|
+
# Select option from select list (dropdown) identified by the value in its *:id* attribute.
|
429
|
+
# Option is selected by its index withing the select list's array of options.
|
430
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
431
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
432
|
+
# @param [Fixnum] index An integer that indicates the index of the element within the array of options.
|
433
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
434
|
+
# @return (see #click_button_by_id)
|
435
|
+
def select_option_by_id_and_index(browser, what, index, desc = '')
|
436
|
+
select_option(browser, :id, what, :index, index, desc)
|
437
|
+
end
|
438
|
+
|
439
|
+
# Select option from select list (dropdown) identified by the value in its *:name* attribute. Option is selected by its *:index* attribute.
|
440
|
+
# @param (see #select_option_by_id_and_index)
|
441
|
+
# @return (see #click_button_by_id)
|
442
|
+
def select_option_by_name_and_index(browser, what, option, desc = '')
|
443
|
+
select_option(browser, :name, what, :index, option, desc)
|
444
|
+
end
|
445
|
+
|
446
|
+
# Select option from select list (dropdown) identified by the xpath command supplied in *what*. Option is selected by its *:index* attribute.
|
447
|
+
# @param (see #select_option_by_id_and_index)
|
448
|
+
# @return (see #click_button_by_id)
|
449
|
+
def select_option_by_xpath_and_index(browser, what, option, desc = '')
|
450
|
+
select_option(browser, :xpath, what, :index, option, desc)
|
451
|
+
end
|
452
|
+
|
453
|
+
# @!endgroup Select
|
454
|
+
|
455
|
+
# @!group Set (UserInput)
|
456
|
+
|
457
|
+
# Set checkbox as checked. Checkbox is identified by the attribute specified in *how* with value *what*. It's *:value* attribute can also be used
|
458
|
+
# when needed by specifying *value*.
|
459
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
460
|
+
# @param [Symbol] how The element attribute used to identify the specific checkbox.
|
461
|
+
# Valid values depend on the kind of element.
|
462
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
463
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the checkbox.
|
464
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute of the checkbox.
|
465
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
466
|
+
# @return (see #click_button_by_id)
|
467
|
+
def set_checkbox(browser, how, what, value = nil, desc = '')
|
468
|
+
set(browser, :checkbox, how, what, value, desc)
|
469
|
+
end
|
470
|
+
|
471
|
+
# Set checkbox as checked identified by its *:class* attribute with the value in *what*. It's *:value* attribute can also be used
|
472
|
+
# when needed by specifying *value*.
|
473
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
474
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the checkbox.
|
475
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute of the checkbox.
|
476
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
477
|
+
# @return (see #click_button_by_id)
|
478
|
+
def set_checkbox_by_class(browser, what, value = nil, desc = '')
|
479
|
+
set(browser, :checkbox, :class, what, value, desc)
|
480
|
+
end
|
481
|
+
|
482
|
+
# Set checkbox as checked identified by its *:class* attribute with the value in *what*. It's *:value* attribute can also be used
|
483
|
+
# when needed by specifying *value*.
|
484
|
+
# @param (see #set_checkbox_by_class)
|
485
|
+
# @return (see #click_button_by_id)
|
486
|
+
def set_checkbox_by_id(browser, what, value = nil, desc = '')
|
487
|
+
set(browser, :checkbox, :id, what, value, desc)
|
488
|
+
end
|
489
|
+
|
490
|
+
# Set checkbox as checked identified by its *:name* attribute with the value in *what*. It's *:value* attribute can also be used
|
491
|
+
# when needed by specifying *value*.
|
492
|
+
# @param (see #set_checkbox_by_class)
|
493
|
+
# @return (see #click_button_by_id)
|
494
|
+
def set_checkbox_by_name(browser, what, value = nil, desc = '')
|
495
|
+
set(browser, :checkbox, :name, what, value, desc)
|
496
|
+
end
|
497
|
+
|
498
|
+
# Set checkbox as checked identified by its *:title* attribute with the value in *what*. It's *:value* attribute can also be used
|
499
|
+
# when needed by specifying *value*.
|
500
|
+
# @param (see #set_checkbox_by_class)
|
501
|
+
# @return (see #click_button_by_id)
|
502
|
+
def set_checkbox_by_title(browser, what, value = nil, desc = '')
|
503
|
+
set(browser, :checkbox, :title, what, value, desc)
|
504
|
+
end
|
505
|
+
|
506
|
+
# Set checkbox as checked identified by its *:value* attribute with the value in *what*.
|
507
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
508
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the checkbox.
|
509
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
510
|
+
# @return (see #click_button_by_id)
|
511
|
+
def set_checkbox_by_value(browser, what, desc = '')
|
512
|
+
set(browser, :checkbox, :value, what, nil, desc)
|
513
|
+
end
|
514
|
+
|
515
|
+
# Set radio button as set. Radio is identified by the attribute specified in *how* with value *what*. It's *:value* attribute can also be used
|
516
|
+
# when needed by specifying *value*.
|
517
|
+
# @param (see #set_checkbox)
|
518
|
+
# @return (see #click_button_by_id)
|
519
|
+
def set_radio(browser, how, what, value = nil, desc = '')
|
520
|
+
set(browser, :radio, how, what, value, desc)
|
521
|
+
end
|
522
|
+
|
523
|
+
# Set radio button as set identified by its *:class* attribute with the value in *what*. It's *:value* attribute can also be used
|
524
|
+
# when needed by specifying *value*.
|
525
|
+
# @param (see #set_checkbox_by_class)
|
526
|
+
def set_radio_by_class(browser, what, value = nil, desc = '')
|
527
|
+
set(browser, :radio, :class, what, value, desc)
|
528
|
+
end
|
529
|
+
|
530
|
+
# Set radio button as set identified by its *:id* attribute with the value in *what*. It's *:value* attribute can also be used
|
531
|
+
# when needed by specifying *value*.
|
532
|
+
# @param (see #set_checkbox_by_class)
|
533
|
+
# @return (see #click_button_by_id)
|
534
|
+
def set_radio_by_id(browser, what, value = nil, desc = '')
|
535
|
+
set(browser, :radio, :id, what, value, desc)
|
536
|
+
end
|
537
|
+
|
538
|
+
# Set radio button as set identified by its index within the array of radio buttons found in the container specified by *browser*.
|
539
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
540
|
+
# @param [Fixnum] index An integer that indicates the index of the element within *browser*.
|
541
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
542
|
+
# @return (see #click_button_by_id)
|
543
|
+
def set_radio_by_index(browser, index, desc = '')
|
544
|
+
set(browser, :radio, :index, index, nil, desc)
|
545
|
+
end
|
546
|
+
|
547
|
+
# Set radio button as set identified by its *:name* attribute with the value in *what*. It's *:value* attribute can also be used
|
548
|
+
# when needed by specifying *value*.
|
549
|
+
# @param (see #set_checkbox_by_class)
|
550
|
+
# @return (see #click_button_by_id)
|
551
|
+
def set_radio_by_name(browser, what, value = nil, desc = '')
|
552
|
+
set(browser, :radio, :name, what, value, desc)
|
553
|
+
end
|
554
|
+
|
555
|
+
# Set radio button as set identified by its *:title* attribute with the value in *what*. It's *:value* attribute can also be used
|
556
|
+
# when needed by specifying *value*.
|
557
|
+
# @param (see #set_checkbox_by_class)
|
558
|
+
# @return (see #click_button_by_id)
|
559
|
+
def set_radio_by_title(browser, what, value = nil, desc = '')
|
560
|
+
set(browser, :radio, :title, what, value, desc)
|
561
|
+
end
|
562
|
+
|
563
|
+
# Set radio button as set identified by its *:value* attribute with the value in *what*.
|
564
|
+
# @param (see #click_button_by_id)
|
565
|
+
# @return (see #click_button_by_id)
|
566
|
+
def set_radio_by_value(browser, what, desc = '')
|
567
|
+
set(browser, :radio, :value, what, nil, desc)
|
568
|
+
end
|
569
|
+
|
570
|
+
# Set radio button as set identified by its *:name* attribute with the value in *what*
|
571
|
+
# and its index within the array of radio buttons with that :name
|
572
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
573
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *:name* attribute that identifies the group of radio buttons.
|
574
|
+
# @param [Fixnum] index An integer that indicates the index of the radio button to be set.
|
575
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
576
|
+
# @return (see #click_button_by_id)
|
577
|
+
def set_radio_by_name_and_index(browser, what, index, desc = '')
|
578
|
+
set_radio_two_attributes(browser, :name, what, :index, index, desc)
|
579
|
+
end
|
580
|
+
|
581
|
+
# Set radio button as set identified by its *:name* attribute with the value in *what*
|
582
|
+
# and its index within the array of radio buttons with that :name
|
583
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
584
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *:name* attribute that identifies the group of radio buttons.
|
585
|
+
# @param [String, Regexp] text A string or a regular expression to be found in the *:text* attribute that uniquely identifies the the radio button to be set.
|
586
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
587
|
+
# @return (see #click_button_by_id)
|
588
|
+
def set_radio_by_name_and_text(browser, what, text, desc = '')
|
589
|
+
set_radio_two_attributes(browser, :name, what, :text, text, desc)
|
590
|
+
end
|
591
|
+
|
592
|
+
# Set radio button as set identified by its *:value* attribute with the value in *what*
|
593
|
+
# and its index within the array of radio buttons with that :name
|
594
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
595
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute that identifies the group of radio buttons.
|
596
|
+
# @param [Fixnum] index An integer that indicates the index of the radio button to be set.
|
597
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
598
|
+
# @return (see #click_button_by_id)
|
599
|
+
def set_radio_by_value_and_index(browser, value, index, desc = '')
|
600
|
+
set_radio_two_attributes(browser, :value, value, :index, index, desc)
|
601
|
+
end
|
602
|
+
|
603
|
+
# Set radio button as set identified by its *:name* attribute with the value in *what*
|
604
|
+
# and the *:value* attribute with the value in *value*.
|
605
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
606
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *:name* attribute that identifies the group of radio buttons.
|
607
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute that uniquely identifies the the radio button to be set.
|
608
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
609
|
+
# @return (see #click_button_by_id)
|
610
|
+
def set_radio_by_name_and_value(browser, what, value, desc = '')
|
611
|
+
set_radio(browser, :name, what, value, desc)
|
612
|
+
end
|
613
|
+
|
614
|
+
# Set file field element, identified by its *:name* attribute with the value in *what*.
|
615
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
616
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
617
|
+
# @param [String] filespec The full path and name of the target file.
|
618
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
619
|
+
# @return (see #click_button_by_id)
|
620
|
+
def set_file_field_by_name(browser, what, filespec, desc = '')
|
621
|
+
set_file_field(browser, :name, what, filespec, desc)
|
622
|
+
end
|
623
|
+
|
624
|
+
# Set file field element, identified by its *:id* attribute with the value in *what*.
|
625
|
+
# @param (see #set_file_field_by_name)
|
626
|
+
# @return (see #click_button_by_id)
|
627
|
+
def set_file_field_by_id(browser, what, filespec, desc = '')
|
628
|
+
set_file_field(browser, :id, what, filespec, desc)
|
629
|
+
end
|
630
|
+
|
631
|
+
# Set text field as identified by its *:name* attribute with value in *what* to the string specified in *value*.
|
632
|
+
# This method validates that the text field has been set to the specified value.
|
633
|
+
# The value verification can be turned off by setting *skip_value_check* to true.
|
634
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
635
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
636
|
+
# @param [String] value A string to enter into the text field.
|
637
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output.
|
638
|
+
# Required if *skip_value_check* is set to true.
|
639
|
+
# @param [Boolean] skip_value_check Forces verification of value in text field to pass.
|
640
|
+
# @return (see #click_button_by_id)
|
641
|
+
def set_textfield_by_name(browser, what, value, desc = '', skip_value_check = false)
|
642
|
+
set_text_field(browser, :name, what, value, desc, skip_value_check)
|
643
|
+
end
|
644
|
+
|
645
|
+
# Set text field as identified by its *:id* attribute with value in *what* to the string specified in *value*.
|
646
|
+
# This method validates that the text field has been set to the specified value.
|
647
|
+
# The value verification can be turned off by setting *skip_value_check* to true.
|
648
|
+
# @param (see #set_textfield_by_name)
|
649
|
+
# @return (see #click_button_by_id)
|
650
|
+
def set_textfield_by_id(browser, what, value, desc = '', skip_value_check = false)
|
651
|
+
set_text_field(browser, :id, what, value, desc, skip_value_check)
|
652
|
+
end
|
653
|
+
|
654
|
+
# Set text field as identified by its *:class* attribute with value in *what* to the string specified in *value*.
|
655
|
+
# This method validates that the text field has been set to the specified value.
|
656
|
+
# The value verification can be turned off by setting *skip_value_check* to true.
|
657
|
+
# @param (see #set_textfield_by_name)
|
658
|
+
# @return (see #click_button_by_id)
|
659
|
+
def set_textfield_by_title(browser, what, value, desc = '', skip_value_check = false)
|
660
|
+
set_text_field(browser, :title, what, value, desc, skip_value_check)
|
661
|
+
end
|
662
|
+
|
663
|
+
# Set text field as identified by its *:class* attribute with value in *what* to the string specified in *value*.
|
664
|
+
# This method validates that the text field has been set to the specified value.
|
665
|
+
# The value verification can be turned off by setting *skip_value_check* to true.
|
666
|
+
# @param (see #set_textfield_by_name)
|
667
|
+
def set_textfield_by_class(browser, what, value, desc = '', skip_value_check = false)
|
668
|
+
set_text_field(browser, :class, what, value, desc, skip_value_check)
|
669
|
+
end
|
670
|
+
|
671
|
+
# @!endgroup Set
|
672
|
+
|
673
|
+
# @!group Clear (UserInput)
|
674
|
+
|
675
|
+
# Clear (uncheck) checkbox identified by the attribute specified in *how* with value *what*.
|
676
|
+
# It's *:value* attribute can also be used when needed by specifying *value*.
|
677
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
678
|
+
# @param [Symbol] how The element attribute used to identify the specific checkbox.
|
679
|
+
# Valid values depend on the kind of element.
|
680
|
+
# Common values: :text, :id, :title, :name, :class.
|
681
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
682
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute of the element.
|
683
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
684
|
+
# @return (see #click_button_by_id)
|
685
|
+
def clear_checkbox(browser, how, what, value = nil, desc = '')
|
686
|
+
clear(browser, :checkbox, how, what, value, desc)
|
687
|
+
end
|
688
|
+
|
689
|
+
# Clear (uncheck) checkbox identified by its *:name* attribute with value *what*.
|
690
|
+
# It's *:value* attribute can also be used when needed by specifying *value*.
|
691
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
692
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
693
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute of the element.
|
694
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
695
|
+
# @return (see #click_button_by_id)
|
696
|
+
def clear_checkbox_by_name(browser, what, value = nil, desc = '')
|
697
|
+
clear(browser, :checkbox, :name, what, value, desc)
|
698
|
+
end
|
699
|
+
|
700
|
+
# Clear (uncheck) checkbox identified by its *:id* attribute with value *what*.
|
701
|
+
# It's *:value* attribute can also be used when needed by specifying *value*.
|
702
|
+
# @param (see #set_file_field_by_name)
|
703
|
+
# @return (see #click_button_by_id)
|
704
|
+
def clear_checkbox_by_name(browser, what, value = nil, desc = '')
|
705
|
+
clear(browser, :checkbox, :id, what, value, desc)
|
706
|
+
end
|
707
|
+
|
708
|
+
# Clear (unset) radio button identified by the attribute specified in *how* with value *what*.
|
709
|
+
# It's *:value* attribute can also be used when needed by specifying *value*.
|
710
|
+
# This clears the specified radio without setting any other radio buttons on.
|
711
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
712
|
+
# @param [Symbol] how The element attribute used to identify the specific checkbox.
|
713
|
+
# Valid values depend on the kind of element.
|
714
|
+
# Common values: :text, :id, :title, :name, :class.
|
715
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
716
|
+
# @param [String, Regexp] value A string or a regular expression to be found in the *:value* attribute of the element.
|
717
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
718
|
+
# @return (see #click_button_by_id)
|
719
|
+
def clear_radio(browser, how, what, value = nil, desc = '')
|
720
|
+
clear(browser, :radio, how, what, value, desc)
|
721
|
+
end
|
722
|
+
|
723
|
+
# @!endgroup Clear
|
724
|
+
|
725
|
+
# @!group Fire Event (UserInput)
|
726
|
+
|
727
|
+
# Fire an event on a link element identified by the value in its text (innerHTML)
|
728
|
+
#
|
729
|
+
# @example
|
730
|
+
# # html for a link element:
|
731
|
+
# # <a href="http://pragmaticprogrammer.com/titles/ruby/" id="one" name="book">Pickaxe</a>
|
732
|
+
#
|
733
|
+
# fire_event_on_link_by_text(browser, 'Pickaxe', 'onMouseOver')
|
734
|
+
#
|
735
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
736
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
737
|
+
# @param [String] event A string identifying the event to be fired.
|
738
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
739
|
+
# @return (see #click_button_by_id)
|
740
|
+
#
|
741
|
+
def fire_event_on_link_by_text(browser, what, event, desc = '')
|
742
|
+
fire_event(browser, :link, :text, what, event, desc)
|
743
|
+
end
|
744
|
+
|
745
|
+
alias fire_event_text fire_event_on_link_by_text
|
746
|
+
alias fire_event_by_text fire_event_on_link_by_text
|
747
|
+
|
748
|
+
# Fire an event on a link element identified by the value in its *:id* attribute.
|
749
|
+
#
|
750
|
+
# @example
|
751
|
+
# # html for a link element:
|
752
|
+
# # <a href="http://pragmaticprogrammer.com/titles/ruby/" id="one" name="book">Pickaxe</a>
|
753
|
+
#
|
754
|
+
# fire_event_on_link_by_id(browser, 'one', 'onMouseOver')
|
755
|
+
#
|
756
|
+
# @param (see #fire_event_on_link_by_text)
|
757
|
+
# @return (see #click_button_by_id)
|
758
|
+
#
|
759
|
+
def fire_event_on_link_by_id(browser, what, event, desc = '')
|
760
|
+
fire_event(browser, :link, :id, what, event, desc)
|
761
|
+
end
|
762
|
+
|
763
|
+
alias fire_event_id fire_event_on_link_by_id
|
764
|
+
alias fire_event_by_id fire_event_on_link_by_id
|
765
|
+
|
766
|
+
# Fire an event on a image element identified by the value in its *:src* attribute.
|
767
|
+
# Take care to escape characters in the source url that are reserved by Regexp.
|
768
|
+
# @param (see #fire_event_on_link_by_text)
|
769
|
+
# @return (see #click_button_by_id)
|
770
|
+
#
|
771
|
+
def fire_event_on_image_by_src(browser, what, event, desc = '')
|
772
|
+
fire_event(browser, :img, :src, what, event, desc)
|
773
|
+
end
|
774
|
+
|
775
|
+
alias fire_event_src fire_event_on_image_by_src
|
776
|
+
alias fire_event_image_by_src fire_event_on_image_by_src
|
777
|
+
|
778
|
+
# @!endgroup Fire Event
|
779
|
+
|
780
|
+
# @!group Validations
|
781
|
+
|
782
|
+
# @param (see #clear_checkbox_by_name)
|
783
|
+
# @return [Boolean] True if the answer to the assertion expressed in the called method name is yes.
|
784
|
+
def validate_textfield_not_value_by_name(browser, what, value, desc = '')
|
785
|
+
textfield_does_not_equal?(browser, :name, what, value, desc)
|
786
|
+
end
|
787
|
+
|
788
|
+
alias validate_textfield_no_value_by_name validate_textfield_not_value_by_name
|
789
|
+
|
790
|
+
# @param (see #clear_checkbox_by_name)
|
791
|
+
# @return (see #validate_textfield_not_value_by_name)
|
792
|
+
def validate_textfield_not_value_by_id(browser, what, value, desc = '')
|
793
|
+
textfield_does_not_equal?(browser, :id, what, value, desc)
|
794
|
+
end
|
795
|
+
|
796
|
+
alias validate_textfield_no_value_by_id validate_textfield_not_value_by_id
|
797
|
+
|
798
|
+
# @param (see #click_button_by_id)
|
799
|
+
# @return (see #validate_textfield_not_value_by_name)
|
800
|
+
def validate_textfield_empty_by_name(browser, what, desc = '')
|
801
|
+
textfield_empty?(browser, :name, what, desc)
|
802
|
+
end
|
803
|
+
|
804
|
+
# @param (see #click_button_by_id)
|
805
|
+
# @return (see #validate_textfield_not_value_by_name)
|
806
|
+
def validate_textfield_empty_by_id(browser, what, desc = '')
|
807
|
+
textfield_empty?(browser, :id, what, desc)
|
808
|
+
end
|
809
|
+
|
810
|
+
# @param (see #click_button_by_id)
|
811
|
+
# @return (see #validate_textfield_not_value_by_name)
|
812
|
+
def validate_textfield_empty_by_title(browser, what, desc = '')
|
813
|
+
textfield_empty?(browser, :title, what, desc)
|
814
|
+
end
|
815
|
+
|
816
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
817
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the specified attribute that uniquely identifies the element.
|
818
|
+
# @param [String, Regexp] expected A string or a regular expression to be found in the *:value* attribute of the element.
|
819
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
820
|
+
# @return (see #validate_textfield_not_value_by_name)
|
821
|
+
def validate_textfield_value_by_name(browser, what, expected, desc = '')
|
822
|
+
textfield_equals?(browser, :name, what, expected, desc)
|
823
|
+
end
|
824
|
+
|
825
|
+
# @param (see #clear_checkbox_by_name)
|
826
|
+
# @return (see #validate_textfield_not_value_by_name)
|
827
|
+
def validate_textfield_value_by_id(browser, what, expected, desc = '')
|
828
|
+
textfield_equals?(browser, :id, what, expected, desc)
|
829
|
+
end
|
830
|
+
|
831
|
+
# @param (see #click_button_by_id)
|
832
|
+
# @return (see #validate_textfield_not_value_by_name)
|
833
|
+
def validate_textfield_visible_by_name(browser, what, desc = '')
|
834
|
+
visible?(browser, :text_field, :name, what, desc)
|
835
|
+
end
|
836
|
+
|
837
|
+
alias visible_textfield_by_name validate_textfield_visible_by_name
|
838
|
+
|
839
|
+
# @param (see #click_button_by_id)
|
840
|
+
# @return (see #validate_textfield_not_value_by_name)
|
841
|
+
def validate_textfield_disabled_by_name(browser, what, desc = '')
|
842
|
+
disabled?(browser, :text_field, :name, what, desc)
|
843
|
+
end
|
844
|
+
|
845
|
+
alias disabled_textfield_by_name validate_textfield_disabled_by_name
|
846
|
+
|
847
|
+
# @param (see #click_button_by_id)
|
848
|
+
# @return (see #validate_textfield_not_value_by_name)
|
849
|
+
def validate_textfield_enabled_by_name(browser, what, desc = '')
|
850
|
+
enabled?(browser, :text_field, :name, what, desc)
|
851
|
+
end
|
852
|
+
|
853
|
+
alias enabled_textfield_by_name validate_textfield_enabled_by_name
|
854
|
+
|
855
|
+
# @param (see #click_button_by_id)
|
856
|
+
# @return (see #validate_textfield_not_value_by_name)
|
857
|
+
def validate_textfield_not_visible_by_name(browser, what, desc = '')
|
858
|
+
not_visible?(browser, :text_field, :name, what, desc)
|
859
|
+
end
|
860
|
+
|
861
|
+
alias visible_no_textfield_by_name validate_textfield_not_visible_by_name
|
862
|
+
|
863
|
+
# @param (see #click_button_by_id)
|
864
|
+
# @return (see #validate_textfield_not_value_by_name)
|
865
|
+
def validate_radio_not_set(browser, what, desc = '')
|
866
|
+
not_set?(browser, :id, what, desc)
|
867
|
+
end
|
868
|
+
|
869
|
+
alias validate_not_radioset validate_radio_not_set
|
870
|
+
|
871
|
+
# @param (see #click_button_by_id)
|
872
|
+
# @return (see #validate_textfield_not_value_by_name)
|
873
|
+
def radio_is_set?(browser, what, desc = '')
|
874
|
+
set?(browser, :id, what, desc)
|
875
|
+
end
|
876
|
+
|
877
|
+
alias validate_radioset radio_is_set?
|
878
|
+
alias validate_radio_set radio_is_set?
|
879
|
+
|
880
|
+
# @param (see #click_button_by_id)
|
881
|
+
# @return (see #validate_textfield_not_value_by_name)
|
882
|
+
def validate_radioset_by_name(browser, what, desc = '')
|
883
|
+
set?(browser, :name, what, desc)
|
884
|
+
end
|
885
|
+
|
886
|
+
# @param (see #click_button_by_id)
|
887
|
+
# @return (see #validate_textfield_not_value_by_name)
|
888
|
+
def checked_by_id?(browser, what, desc = '')
|
889
|
+
checked?(browser, :id, what, desc)
|
890
|
+
end
|
891
|
+
|
892
|
+
alias validate_check checked_by_id?
|
893
|
+
alias checkbox_is_checked? checked_by_id?
|
894
|
+
|
895
|
+
# @param (see #click_button_by_id)
|
896
|
+
# @return (see #validate_textfield_not_value_by_name)
|
897
|
+
def checkbox_is_enabled?(browser, what, desc = '')
|
898
|
+
enabled?(browser, :checkbox, :id, what, desc)
|
899
|
+
end
|
900
|
+
|
901
|
+
alias validate_check_enabled checkbox_is_enabled?
|
902
|
+
|
903
|
+
# @param (see #click_button_by_id)
|
904
|
+
# @return (see #validate_textfield_not_value_by_name)
|
905
|
+
def checkbox_is_disabled?(browser, what, desc = '')
|
906
|
+
disabled?(browser, :checkbox, :id, what, desc)
|
907
|
+
end
|
908
|
+
|
909
|
+
alias validate_check_disabled checkbox_is_disabled?
|
910
|
+
|
911
|
+
# @param (see #click_button_by_id)
|
912
|
+
# @return (see #validate_textfield_not_value_by_name)
|
913
|
+
def validate_check_by_class(browser, what, desc)
|
914
|
+
checked?(browser, :class, what, desc)
|
915
|
+
end
|
916
|
+
|
917
|
+
# @param (see #click_button_by_id)
|
918
|
+
# @return (see #validate_textfield_not_value_by_name)
|
919
|
+
def checkbox_not_checked?(browser, what, desc)
|
920
|
+
not_checked?(browser, :id, what, desc)
|
921
|
+
end
|
922
|
+
|
923
|
+
alias validate_not_check checkbox_not_checked?
|
924
|
+
|
925
|
+
# @param (see #click_button_by_id)
|
926
|
+
# @return (see #validate_textfield_not_value_by_name)
|
927
|
+
def validate_image(browser, what, desc = '', nofail = false)
|
928
|
+
exists?(browser, :image, :src, what, desc)
|
929
|
+
end
|
930
|
+
|
931
|
+
# Verify that link identified by *:text* exists.
|
932
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
933
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
934
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
935
|
+
# @return [Boolean] True if the element exists.
|
936
|
+
def validate_link_exist(browser, what, desc = '')
|
937
|
+
exists?(browser, :link, :text, what, nil, desc)
|
938
|
+
end
|
939
|
+
|
940
|
+
# Verify that link identified by *:text* does not exist.
|
941
|
+
# @param (see #click_button_by_id)
|
942
|
+
# @return [Boolean] True if the element is does not exist.
|
943
|
+
def link_not_exist?(browser, what, desc = '')
|
944
|
+
does_not_exist?(browser, :link, :text, what, nil, desc)
|
945
|
+
end
|
946
|
+
|
947
|
+
alias validate_link_not_exist link_not_exist?
|
948
|
+
|
949
|
+
# Verify that div identified by *:id* is visible.
|
950
|
+
# @param (see #click_button_by_id)
|
951
|
+
# @return [Boolean] True if the element is visible.
|
952
|
+
def validate_div_visible_by_id(browser, what, desc = '')
|
953
|
+
visible?(browser, :div, :id, what, desc)
|
954
|
+
end
|
955
|
+
|
956
|
+
# Verify that div identified by *:id* is not visible.
|
957
|
+
# @param (see #click_button_by_id)
|
958
|
+
# @return [Boolean] True if the element is not visible.
|
959
|
+
def validate_div_not_visible_by_id(browser, what, desc = '')
|
960
|
+
not_visible?(browser, :div, :id, what, desc)
|
961
|
+
end
|
962
|
+
|
963
|
+
# Verify that div click_button_by_id by *:text* is enabled.
|
964
|
+
# @param (see #click_button_by_id)
|
965
|
+
# @return [Boolean] True if the element is enabled.
|
966
|
+
def link_enabled?(browser, what, desc = '')
|
967
|
+
enabled?(browser, :link, :text, what, desc)
|
968
|
+
end
|
969
|
+
|
970
|
+
alias validate_link_enabled link_enabled?
|
971
|
+
alias check_link_enabled link_enabled?
|
972
|
+
|
973
|
+
# Verify that div identified by *:text* is disabled.
|
974
|
+
# @param (see #click_button_by_id)
|
975
|
+
# @return [Boolean] True if the element is disabled.
|
976
|
+
def link_disabled?(browser, what, desc = '')
|
977
|
+
disabled?(browser, :link, :text, what, desc)
|
978
|
+
end
|
979
|
+
|
980
|
+
alias validate_link_not_enabled link_disabled?
|
981
|
+
|
982
|
+
def check_element_is_disabled(browser, element, how, what, desc = '')
|
983
|
+
disabled?(browser, element, how, what, desc)
|
984
|
+
end
|
985
|
+
|
986
|
+
# Verify that select list, identified by :id and *what* contains *text* and select it if present
|
987
|
+
# @param (see #clear_checkbox_by_name)
|
988
|
+
# @return (see #validate_textfield_not_value_by_name)
|
989
|
+
def validate_list(browser, what, expected, desc = '')
|
990
|
+
validate_list_by_id(browser, what, expected, desc)
|
991
|
+
end
|
992
|
+
|
993
|
+
# Verify select list, identified by *:id*, does not contain *text*
|
994
|
+
# @param (see #clear_checkbox_by_name)
|
995
|
+
# @return (see #validate_textfield_not_value_by_name)
|
996
|
+
def validate_no_list(browser, what, expected, desc = '')
|
997
|
+
select_list_does_not_include?(browser, :id, what, expected, desc)
|
998
|
+
end
|
999
|
+
|
1000
|
+
# @param (see #clear_checkbox_by_name)
|
1001
|
+
# @return (see #validate_textfield_not_value_by_name)
|
1002
|
+
def text_in_span_equals?(browser, how, what, expected, desc = '')
|
1003
|
+
text_in_element_equals?(browser, :span, how, what, expected, desc)
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
# @param (see #clear_checkbox_by_name)
|
1007
|
+
# @return (see #validate_textfield_not_value_by_name)
|
1008
|
+
def span_contains_text?(browser, how, what, expected, desc = '')
|
1009
|
+
element_contains_text?(browser, :span, how, what, expected, desc)
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
alias valid_text_in_span span_contains_text?
|
1013
|
+
|
1014
|
+
# @param (see #clear_checkbox_by_name)
|
1015
|
+
# @return (see #validate_textfield_not_value_by_name)
|
1016
|
+
def validate_text_in_span_by_id(browser, what, expected, desc = '')
|
1017
|
+
element_contains_text?(browser, :span, :id, what, expected, desc)
|
1018
|
+
end
|
1019
|
+
|
1020
|
+
# @!endgroup Validations
|
1021
|
+
|
1022
|
+
# @!group Find
|
1023
|
+
|
1024
|
+
# Return the list of options in a select list identified by its *:id* attribute.
|
1025
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
1026
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
1027
|
+
# @param [Boolean] dbg Triggers additional debug logging when set to true.
|
1028
|
+
# @return [Array]
|
1029
|
+
def get_select_options_by_id(browser, what, dbg = false)
|
1030
|
+
get_select_options(browser, :id, what, dbg)
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
# Return the list of options in a select list identified by its *:name* attribute.
|
1034
|
+
# @param (see #get_select_options_by_id)
|
1035
|
+
# @return [Array]
|
1036
|
+
def get_select_options_by_name(browser, what, dbg = false)
|
1037
|
+
get_select_options(browser, :name, what, dbg)
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
# Return the list of _selected_ options in a select list identified by its *:id* attribute.
|
1041
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
1042
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
1043
|
+
# @return [Array]
|
1044
|
+
def get_selected_options_by_id(browser, what)
|
1045
|
+
get_selected_options(browser, :id, what)
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
alias get_selected_option_by_id get_selected_options_by_id
|
1049
|
+
|
1050
|
+
# Return the list of _selected_ options in a select list identified by its *:name* attribute.
|
1051
|
+
# @param (see #get_select_options_by_id)
|
1052
|
+
# @return [Array]
|
1053
|
+
def get_selected_options_by_name(browser, what)
|
1054
|
+
get_selected_options(browser, :name, what)
|
1055
|
+
end
|
1056
|
+
|
1057
|
+
alias get_selected_option_by_name get_selected_options_by_name
|
1058
|
+
|
1059
|
+
# Return a reference to a div element identified by its *:id* attribute.
|
1060
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
1061
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
1062
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
1063
|
+
# @param [Boolean] dbg Triggers additional debug logging when set to true.
|
1064
|
+
# @return [Water::Div]
|
1065
|
+
def get_div_by_id(browser, what, desc = '', dbg = false)
|
1066
|
+
get_div(browser, :id, what, desc, dbg)
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
# Return a reference to a div element identified by its *:class* attribute.
|
1070
|
+
# @param (see #get_div_by_id)
|
1071
|
+
# @return [Water::Div]
|
1072
|
+
def get_div_by_class(browser, what, desc = '', dbg = false)
|
1073
|
+
get_div(browser, :class, what, desc, dbg)
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
# Return a reference to a div element identified by its *:text* attribute.
|
1077
|
+
# @param (see #get_div_by_id)
|
1078
|
+
# @return [Water::Div]
|
1079
|
+
def get_div_by_text(browser, what, desc = '', dbg = false)
|
1080
|
+
get_div(browser, :text, what, desc, dbg)
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
# Return a reference to a form element identified by its *:id* attribute.
|
1084
|
+
# @param (see #click_button_by_id)
|
1085
|
+
# @return [Water::Form]
|
1086
|
+
def get_form_by_id(browser, what, desc = '')
|
1087
|
+
get_form(browser, :id, what, desc)
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
# Return a reference to a frame element identified by its *:id* attribute.
|
1091
|
+
# @param (see #click_button_by_id)
|
1092
|
+
# @return [Water::Frame]
|
1093
|
+
def get_frame_by_id(browser, what, desc = '')
|
1094
|
+
get_frame(browser, :id, what, desc)
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
# Return a reference to a frame element identified by its *:index* within *browser*.
|
1098
|
+
# @param (see #click_button_by_id)
|
1099
|
+
# @return [Water::Frame]
|
1100
|
+
def get_frame_by_index(browser, what, desc = '')
|
1101
|
+
get_frame(browser, :index, what, desc)
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
# Return a reference to a frame element identified by its *:name* attribute.
|
1105
|
+
# @param (see #click_button_by_id)
|
1106
|
+
# @return [Water::Frame]
|
1107
|
+
def get_frame_by_name(browser, what, desc = '')
|
1108
|
+
get_frame(browser, :name, what, desc)
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
# Return a reference to a span element identified by its *:id* attribute.
|
1112
|
+
# @param (see #click_button_by_id)
|
1113
|
+
# @return [Water::Span]
|
1114
|
+
def get_span_by_id(browser, what, desc = '')
|
1115
|
+
get_span(browser, :id, what, desc)
|
1116
|
+
end
|
1117
|
+
|
1118
|
+
# Return a reference to a table element identified by its attribute *how* containing *what*.
|
1119
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
1120
|
+
# @param [Symbol] how The element attribute used to identify the specific element.
|
1121
|
+
# Valid values depend on the kind of element.
|
1122
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
1123
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
1124
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
1125
|
+
# @return [Watir::Table]
|
1126
|
+
def get_table(browser, how, what, desc = '')
|
1127
|
+
get_element(browser, :table, how, what, nil, desc)
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
# Return a reference to a table element identified by its *:id* attribute.
|
1131
|
+
# @param (see #click_button_by_id)
|
1132
|
+
# @return [Watir::Table]
|
1133
|
+
def get_table_by_id(browser, what, desc = '')
|
1134
|
+
get_element(browser, :table, :id, what, nil, desc)
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
# Return a reference to a table element identified by its *:index* within *browser*.
|
1138
|
+
# @param (see #click_button_by_id)
|
1139
|
+
# @return [Watir::Table]
|
1140
|
+
def get_table_by_index(browser, what, desc = '')
|
1141
|
+
get_element(browser, :table, :index, what, nil, desc)
|
1142
|
+
end
|
1143
|
+
|
1144
|
+
# Return a reference to a table element identified by its *:text* attribute.
|
1145
|
+
# @param (see #get_table)
|
1146
|
+
# @return [Watir::Table]
|
1147
|
+
def get_table_by_text(browser, what)
|
1148
|
+
get_element(browser, :table, :text, what, nil, desc)
|
1149
|
+
end
|
1150
|
+
|
1151
|
+
# @!endgroup Find
|
1152
|
+
|
1153
|
+
# @!group Wait
|
1154
|
+
|
1155
|
+
# Wait until radio button, identified by attribute :value with value *what* exists on the page.
|
1156
|
+
# Timeout is the default used by watir (60 seconds)
|
1157
|
+
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
1158
|
+
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
1159
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
1160
|
+
# @return [Boolean] True if radio exists within timeout limit
|
1161
|
+
def wait_until_by_radio_value(browser, what, desc = '')
|
1162
|
+
wait_until_exists(browser, :radio, :value, what, desc)
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
# Wait up to *how_long* seconds for DOM element *what_for* to exist in the page.
|
1166
|
+
# @note This is a last resort method when other wait or wait until avenues have
|
1167
|
+
# been exhausted.
|
1168
|
+
# @param [Fixnum] how_long Timeout limit
|
1169
|
+
# @param [Watir::Element] what_for A reference to a Dom element to wait for.
|
1170
|
+
def wait_for_exists(how_long, what_for)
|
1171
|
+
wait_for(how_long, what_for)
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
# Wait until link, identified by attribute :text with value *what* exists on the page.
|
1175
|
+
# Timeout is the default used by watir (60 seconds)
|
1176
|
+
# @param (see #wait_until_by_radio_value)
|
1177
|
+
# @return [Boolean] True if link exists within timeout limit
|
1178
|
+
def wait_until_by_link_text(browser, what, desc = '')
|
1179
|
+
wait_until_exists(browser, :link, :text, what, desc)
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
# @!endgroup Wait
|
9
1183
|
|
10
1184
|
end
|
11
1185
|
end
|