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
@@ -17,6 +17,27 @@ module Awetestlib
|
|
17
17
|
|
18
18
|
# @!group Browser
|
19
19
|
|
20
|
+
# @note webdriver specific - still work in progress
|
21
|
+
def go_to_wd_url(browser, url)
|
22
|
+
|
23
|
+
Watir::Browser.class_eval do
|
24
|
+
def goto(uri)
|
25
|
+
uri = "http://#{uri}" unless uri =~ URI.regexp
|
26
|
+
@driver.navigate.to uri
|
27
|
+
run_checkers
|
28
|
+
end
|
29
|
+
end
|
30
|
+
browser.goto(url)
|
31
|
+
|
32
|
+
#in basic_auth1 edit:
|
33
|
+
#a = Thread.new {
|
34
|
+
# goto_wd_url(browser, @myURL)
|
35
|
+
# }
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
alias goto_wd_url go_to_wd_url
|
40
|
+
|
20
41
|
# Open a browser based on the command line parameters that identify the browser and
|
21
42
|
# version to use for the test.
|
22
43
|
# @example
|
@@ -24,7 +45,7 @@ module Awetestlib
|
|
24
45
|
# @param [String, Regexp] url When provided, the browser will go to this url.
|
25
46
|
# @return [Watir::Browser]
|
26
47
|
def open_browser(url = nil)
|
27
|
-
|
48
|
+
message_to_report("Opening browser: #{@targetBrowser.name}")
|
28
49
|
case @targetBrowser.abbrev
|
29
50
|
when 'IE'
|
30
51
|
@myBrowser = open_ie
|
@@ -96,24 +117,13 @@ module Awetestlib
|
|
96
117
|
if url
|
97
118
|
@myURL = url
|
98
119
|
end
|
99
|
-
|
120
|
+
message_to_report("URL: #{@myURL}")
|
100
121
|
browser.goto(@myURL)
|
101
122
|
true
|
102
123
|
rescue
|
103
124
|
fatal_to_log("Unable to navigate to '#{@myURL}': '#{$!}'")
|
104
125
|
end
|
105
126
|
|
106
|
-
def go_to_wd_url(browser, url)
|
107
|
-
Watir::Browser.class_eval do
|
108
|
-
def goto(uri)
|
109
|
-
uri = "http://#{uri}" unless uri =~ URI.regexp
|
110
|
-
@driver.navigate.to uri
|
111
|
-
run_checkers
|
112
|
-
end
|
113
|
-
end
|
114
|
-
browser.goto(url)
|
115
|
-
end
|
116
|
-
|
117
127
|
# Return a reference to a browser window. Used to attach a browser window to a variable
|
118
128
|
# which can then be passed to methods that require a *browser* parameter.
|
119
129
|
# @example
|
@@ -324,7 +334,7 @@ module Awetestlib
|
|
324
334
|
ts = Time.new
|
325
335
|
msg = "Bailing out at util line #{lnbr} #{ts} " + desc
|
326
336
|
puts "#{msg}"
|
327
|
-
fatal_to_log(msg,
|
337
|
+
fatal_to_log(msg, lnbr)
|
328
338
|
debug_to_log(dump_caller(lnbr))
|
329
339
|
if is_browser?(browser)
|
330
340
|
if @browserAbbrev == 'IE'
|
@@ -588,7 +598,7 @@ module Awetestlib
|
|
588
598
|
begin
|
589
599
|
panel.link(:text, what).click
|
590
600
|
rescue => e
|
591
|
-
|
601
|
+
unless rescue_me(e, __method__, rescue_me_command(:link, :id, what, :click), "#{panel.class}")
|
592
602
|
raise e
|
593
603
|
end
|
594
604
|
end
|
@@ -688,7 +698,7 @@ module Awetestlib
|
|
688
698
|
begin
|
689
699
|
popup.link(:text, what).click
|
690
700
|
rescue => e
|
691
|
-
|
701
|
+
unless rescue_me(e, __method__, rescue_me_command(:link, :text, what, :click), "#{popup.class}")
|
692
702
|
raise e
|
693
703
|
end
|
694
704
|
end
|
@@ -803,11 +813,28 @@ module Awetestlib
|
|
803
813
|
failed_to_log("Close popup title=#{title} failed: '#{$!}' (#{__LINE__})")
|
804
814
|
end
|
805
815
|
|
806
|
-
alias close_popup_validate_text close_modal_ie
|
807
|
-
alias close_popup close_modal_ie
|
816
|
+
#alias close_popup_validate_text close_modal_ie
|
817
|
+
#alias close_popup close_modal_ie
|
808
818
|
|
809
819
|
# private :close_modal_ie
|
810
820
|
|
821
|
+
# Close an IE modal popup by its title. Calls close_modal_ie.
|
822
|
+
# @deprecated Use close_modal.
|
823
|
+
# @param [String] title The title of the window to be closed. Matched from beginning of string.
|
824
|
+
# @param [String] button The display name of the button to be clicked.
|
825
|
+
# @param [String] text The text of the window to be closed. Matched from beginning of string.
|
826
|
+
# @param [String] side A string identifying which mouse button to click.
|
827
|
+
# @param [Fixnum] wait Number of seconds to wait for the popup to be seen.
|
828
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
829
|
+
# @param [Boolean] quiet If true, fewer messages and pass/fail validations are logged.
|
830
|
+
def close_popup(title = '', button = 'OK', text = '', side = 'primary',
|
831
|
+
wait = WAIT, desc = '', quiet = false)
|
832
|
+
debug_to_log("#{__method__} begin")
|
833
|
+
close_modal_ie(@myBrowser, title, button, text, side, wait, desc, quiet)
|
834
|
+
end
|
835
|
+
|
836
|
+
alias close_popup_validate_text close_popup
|
837
|
+
|
811
838
|
# Close a Firefox modal popup by its title.
|
812
839
|
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
813
840
|
# @param [String] title The title of the window to be closed. Matched from beginning of string.
|
@@ -1052,71 +1079,34 @@ module Awetestlib
|
|
1052
1079
|
when 'IE'
|
1053
1080
|
@browserAbbrev = 'IE'
|
1054
1081
|
@browserName = 'Internet Explorer'
|
1055
|
-
|
1082
|
+
if $watir_script
|
1083
|
+
@browserAppInfo = browser.document.invoke('parentWindow').navigator.appVersion
|
1084
|
+
else
|
1085
|
+
@browserAppInfo = browser.execute_script("return navigator.userAgent;")
|
1086
|
+
end
|
1056
1087
|
@browserAppInfo =~ /MSIE\s(.*?);/
|
1057
1088
|
@browserVersion = $1
|
1058
1089
|
when 'FF'
|
1059
|
-
#@browserAbbrev = 'FF'
|
1060
|
-
#@browserName = 'Firefox'
|
1061
|
-
#js_stuff = <<-end_js_stuff
|
1062
|
-
#var info = Components.classes["@mozilla.org/xre/app-info;1"]
|
1063
|
-
#.getService(Components.interfaces.nsIXULAppInfo);
|
1064
|
-
#[info, info.name, info.version];
|
1065
|
-
#end_js_stuff
|
1066
|
-
#js_stuff.gsub!("\n", " ")
|
1067
|
-
#info = browser.execute_script(js_stuff)
|
1068
|
-
#info, aName, @browserVersion = info.split(',')
|
1069
|
-
#debug_to_log("FF info: [#{info}]")
|
1070
|
-
#debug_to_log("FF name: [#{aName}]")
|
1071
|
-
#debug_to_log("FF vrsn: [#{@browserVersion}]")
|
1072
1090
|
@browserAbbrev = 'FF'
|
1073
1091
|
@browserName = 'Firefox'
|
1074
1092
|
@browserVersion = '6.01' #TODO: get actual version from browser
|
1075
|
-
|
1093
|
+
@browserAppInfo = browser.execute_script("return navigator.userAgent;")
|
1094
|
+
debug_to_log("#{@browserName}, @browserAppInfo: (#{@browserAppInfo})")
|
1076
1095
|
when 'S'
|
1077
1096
|
@browserAbbrev = 'S'
|
1078
1097
|
@browserName = 'Safari'
|
1079
1098
|
@browserVersion = '5.0.4' #TODO: get actual version from browser itself
|
1080
|
-
|
1099
|
+
@browserAppInfo = browser.execute_script("return navigator.userAgent;")
|
1100
|
+
debug_to_log("#{@browserName}, @browserAppInfo: (#{@browserAppInfo})")
|
1081
1101
|
when 'C'
|
1082
1102
|
@browserAbbrev = 'C'
|
1083
1103
|
@browserName = 'Chrome'
|
1084
1104
|
@browserVersion = '11.0' #TODO: get actual version from browser
|
1085
|
-
|
1105
|
+
@browserAppInfo = browser.execute_script("return navigator.userAgent;")
|
1106
|
+
debug_to_log("#{@browserName}, @browserAppInfo: (#{@browserAppInfo})")
|
1086
1107
|
end
|
1087
|
-
# if [notify_queue, notify_class, notify_id].all?
|
1088
|
-
# Resque::Job.create(notify_queue, notify_class, :id => notify_id, :browser_used => "#{@browserName} #{@browserVersion}")
|
1089
|
-
#end
|
1090
1108
|
rescue
|
1091
1109
|
debug_to_log("Unable to determine #{@browserAbbrev} browser version: '#{$!}' (#{__LINE__})")
|
1092
|
-
|
1093
|
-
# TODO: can we get rid of this?
|
1094
|
-
# js for getting firefox version information
|
1095
|
-
# function getAppID() {
|
1096
|
-
# var id;
|
1097
|
-
# if("@mozilla.org/xre/app-info;1" in Components.classes) {
|
1098
|
-
# // running under Mozilla 1.8 or later
|
1099
|
-
# id = Components.classes["@mozilla.org/xre/app-info;1"]
|
1100
|
-
# .getService(Components.interfaces.nsIXULAppInfo).ID;
|
1101
|
-
# } else {
|
1102
|
-
# try {
|
1103
|
-
# id = Components.classes["@mozilla.org/preferences-service;1"]
|
1104
|
-
# .getService(Components.interfaces.nsIPrefBranch)
|
1105
|
-
# .getCharPref("app.id");
|
1106
|
-
# } catch(e) {
|
1107
|
-
# // very old version
|
1108
|
-
# dump(e);
|
1109
|
-
# }
|
1110
|
-
# }
|
1111
|
-
# return id;
|
1112
|
-
# }
|
1113
|
-
# alert(getAppID());
|
1114
|
-
# another snippet that shows getting attributes from object
|
1115
|
-
# var info = Components.classes["@mozilla.org/xre/app-info;1"]
|
1116
|
-
# .getService(Components.interfaces.nsIXULAppInfo);
|
1117
|
-
# // Get the name of the application running us
|
1118
|
-
# info.name; // Returns "Firefox" for Firefox
|
1119
|
-
# info.version; // Returns "2.0.0.1" for Firefox version 2.0.0.1
|
1120
1110
|
ensure
|
1121
1111
|
message_to_log("Browser: [#{@browserAbbrev} #{@browserVersion}]")
|
1122
1112
|
end
|
@@ -1156,15 +1146,15 @@ module Awetestlib
|
|
1156
1146
|
# @param [Boolean] dbg If set to true additional debug messages are written to the log.
|
1157
1147
|
#
|
1158
1148
|
# @return [Boolean] True if no error conditions have been encountered.
|
1159
|
-
def validate(browser, file_name =
|
1149
|
+
def validate(browser, file_name = @myName, lnbr = "#{__LINE__}", dbg = false)
|
1160
1150
|
debug_to_log("#{__method__} begin") if dbg
|
1161
1151
|
msg = ''
|
1162
1152
|
myOK = true
|
1163
1153
|
if not browser
|
1164
1154
|
msg = "#{file_name}----browser is nil object. (#{lnbr})"
|
1165
1155
|
myOK = false
|
1166
|
-
elsif not
|
1167
|
-
msg = "#{file_name}----not a
|
1156
|
+
elsif not browser.class.to_s =~ /Watir/
|
1157
|
+
msg = "#{file_name}----not a Watir object. (#{lnbr})"
|
1168
1158
|
debug_to_log(browser.inspect)
|
1169
1159
|
myOK = false
|
1170
1160
|
|
@@ -1189,7 +1179,7 @@ module Awetestlib
|
|
1189
1179
|
begin
|
1190
1180
|
browser_text = browser.text.downcase
|
1191
1181
|
rescue => e
|
1192
|
-
|
1182
|
+
unless rescue_me(e, __method__, "browser.text.downcase", "#{browser.class}", browser)
|
1193
1183
|
debug_to_log("browser.text.downcase in #{__method__} #{browser.class}")
|
1194
1184
|
debug_to_log("#{get_callers}")
|
1195
1185
|
raise e
|
@@ -1326,7 +1316,7 @@ module Awetestlib
|
|
1326
1316
|
|
1327
1317
|
rescue
|
1328
1318
|
errmsg = $!
|
1329
|
-
if errmsg.match(msg)
|
1319
|
+
if errmsg and errmsg.match(msg)
|
1330
1320
|
errmsg = ''
|
1331
1321
|
end
|
1332
1322
|
bail_out(browser, lnbr, "#{msg} #{errmsg}")
|
@@ -7,10 +7,14 @@ module Awetestlib
|
|
7
7
|
# Rdoc is work in progress
|
8
8
|
module DragAndDrop
|
9
9
|
|
10
|
+
# Verify that specified *inner_element* is fully enclosed by *outer_element*.
|
11
|
+
# @param [Watir::Element] inner_element A reference to a DOM element
|
12
|
+
# @param [Watir::Element] outer_element A reference to a DOM element
|
13
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
10
14
|
def verify_element_inside(inner_element, outer_element, desc = '')
|
11
15
|
mark_testlevel("#{__method__.to_s.titleize}", 3)
|
12
|
-
msg = "#{inner_element.class.to_s} (:id=#{inner_element.id}) is fully enclosed by
|
13
|
-
|
16
|
+
msg = build_message("#{inner_element.class.to_s} (:id=#{inner_element.id}) is fully enclosed by "+
|
17
|
+
"#{outer_element.class.to_s} (:id=#{outer_element.id}).", desc)
|
14
18
|
if overlay?(inner_element, outer_element, :inside)
|
15
19
|
failed_to_log(msg)
|
16
20
|
else
|
@@ -21,11 +25,21 @@ module Awetestlib
|
|
21
25
|
failed_to_log("Unable to verify that #{msg} '#{$!}'")
|
22
26
|
end
|
23
27
|
|
28
|
+
# Verify that two elements, identified by specified attribute and value, do not overlap on a given *side*.
|
29
|
+
# @param [Symbol] above_element The element type for the first element, e.g. :div, :span, etc.
|
30
|
+
# @param [Symbol] above_how The element attribute used to identify the *above_element*.
|
31
|
+
# Valid values depend on the kind of element.
|
32
|
+
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
33
|
+
# @param [String, Regexp] above_what A string or a regular expression to be found in the *above_how* attribute that uniquely identifies the element.
|
34
|
+
# @param [Symbol] below_element The element type for the second element, e.g. :div, :span, etc.
|
35
|
+
# @param [Symbol] below_how The element attribute used to identify the *below_element*.
|
36
|
+
# @param [String, Regexp] below_what A string or a regular expression to be found in the *below_how* attribute that uniquely identifies the element.
|
37
|
+
# @param [Symbol] side :top, :bottom, :left, :right, :inside, or :outside
|
38
|
+
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
24
39
|
def verify_no_element_overlap(browser, above_element, above_how, above_what, below_element, below_how, below_what, side, desc = '')
|
25
40
|
mark_testlevel("#{__method__.to_s.titleize}", 3)
|
26
|
-
msg = "#{above_element.to_s.titleize} #{above_how}=>#{above_what} does not overlap "+
|
27
|
-
|
28
|
-
msg << " #{desc}" if desc.length > 0
|
41
|
+
msg = build_message("#{above_element.to_s.titleize} #{above_how}=>#{above_what} does not overlap "+
|
42
|
+
"#{below_element.to_s.titleize} #{below_how}=>#{below_what} at the #{side}.", desc)
|
29
43
|
above = browser.element(above_how, above_what)
|
30
44
|
below = browser.element(below_how, below_what)
|
31
45
|
if overlay?(above, below, side)
|
@@ -270,6 +284,18 @@ module Awetestlib
|
|
270
284
|
[x, y, w, h]
|
271
285
|
end
|
272
286
|
|
287
|
+
def drag_and_drop(browser, how, what, delta_x, delta_y, desc = '')
|
288
|
+
#TODO: webdriver
|
289
|
+
msg = "Drag and drop element :#{how}=>#{what} by x=>#{delta_x} y=>#{delta_y}."
|
290
|
+
msg << " #{desc}" if desc.length > 0
|
291
|
+
drag_me = browser.div(how, what)
|
292
|
+
drag_me.drag_and_drop_by(delta_x, delta_y)
|
293
|
+
passed_to_log(msg)
|
294
|
+
true
|
295
|
+
rescue
|
296
|
+
failed_to_log("Unable to #{msg} '#{$!}'")
|
297
|
+
end
|
298
|
+
|
273
299
|
def drag_and_drop(x1, y1, dx, dy, speed=nil)
|
274
300
|
speed = 10 if not speed
|
275
301
|
x2 = x1 + dx
|
@@ -67,11 +67,28 @@ module Awetestlib
|
|
67
67
|
nil
|
68
68
|
end
|
69
69
|
rescue => e
|
70
|
-
|
70
|
+
unless rescue_me(e, __method__, rescue_me_command(target, how, what), "#{browser.class}", target)
|
71
71
|
raise e
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
def get_attribute_value(browser, element, how, what, attribute, desc = '')
|
76
|
+
msg = build_message("Value of #{attribute} in #{element} #{how}=>#{what}.", desc)
|
77
|
+
case element
|
78
|
+
when :link
|
79
|
+
value = browser.link(how => what).attribute_value attribute
|
80
|
+
when :button
|
81
|
+
value = browser.button(how => what).attribute_value attribute
|
82
|
+
else
|
83
|
+
if browser.element(how => what).responds_to('attribute_value')
|
84
|
+
value = browser.element(how => what).attribute_value attribute
|
85
|
+
end
|
86
|
+
end
|
87
|
+
value
|
88
|
+
rescue
|
89
|
+
failed_to_log(" Unable to #{msg}: '#{$!}'")
|
90
|
+
end
|
91
|
+
|
75
92
|
# Return an array containing the options available for selection in a select_list identifified by
|
76
93
|
# its attribute *how*, and the contents of that attribute *what*.
|
77
94
|
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
@@ -104,7 +121,7 @@ module Awetestlib
|
|
104
121
|
begin
|
105
122
|
list = browser.select_list(how, what)
|
106
123
|
rescue => e
|
107
|
-
|
124
|
+
unless rescue_me(e, __method__, rescue_me_command(:select_list, how, what), "#{browser.class}")
|
108
125
|
raise e
|
109
126
|
end
|
110
127
|
end
|
@@ -151,14 +168,14 @@ module Awetestlib
|
|
151
168
|
begin
|
152
169
|
Watir::Wait.until { browser.span(how, what).exists? }
|
153
170
|
rescue => e
|
154
|
-
|
171
|
+
unless rescue_me(e, __method__, rescue_me_command(:span, how, what, :exists?), "#{browser.class}")
|
155
172
|
raise e
|
156
173
|
end
|
157
174
|
end
|
158
175
|
begin
|
159
176
|
span = browser.span(how, what)
|
160
177
|
rescue => e
|
161
|
-
|
178
|
+
unless rescue_me(e, __method__, rescue_me_command(:span, how, what, :exists?), "#{browser.class}")
|
162
179
|
raise e
|
163
180
|
end
|
164
181
|
end
|
@@ -293,141 +310,6 @@ module Awetestlib
|
|
293
310
|
|
294
311
|
# @!endgroup Core
|
295
312
|
|
296
|
-
# @!group Legacy (Backward compatible usages)
|
297
|
-
|
298
|
-
# Return the list of options in a select list identified by its *:id* attribute.
|
299
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
300
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
301
|
-
# @param [Boolean] dbg Triggers additional debug logging when set to true.
|
302
|
-
# @return [Array]
|
303
|
-
def get_select_options_by_id(browser, what, dbg = false)
|
304
|
-
get_select_options(browser, :id, what, dbg)
|
305
|
-
end
|
306
|
-
|
307
|
-
# Return the list of options in a select list identified by its *:name* attribute.
|
308
|
-
# @param (see #get_select_options_by_id)
|
309
|
-
# @return [Array]
|
310
|
-
def get_select_options_by_name(browser, what, dbg = false)
|
311
|
-
get_select_options(browser, :name, what, dbg)
|
312
|
-
end
|
313
|
-
|
314
|
-
# Return the list of _selected_ options in a select list identified by its *:id* attribute.
|
315
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
316
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
317
|
-
# @return [Array]
|
318
|
-
def get_selected_options_by_id(browser, what)
|
319
|
-
get_selected_options(browser, :id, what)
|
320
|
-
end
|
321
|
-
|
322
|
-
alias get_selected_option_by_id get_selected_options_by_id
|
323
|
-
|
324
|
-
# Return the list of _selected_ options in a select list identified by its *:name* attribute.
|
325
|
-
# @param (see #get_select_options_by_id)
|
326
|
-
# @return [Array]
|
327
|
-
def get_selected_options_by_name(browser, what)
|
328
|
-
get_selected_options(browser, :name, what)
|
329
|
-
end
|
330
|
-
|
331
|
-
alias get_selected_option_by_name get_selected_options_by_name
|
332
|
-
|
333
|
-
# Return a reference to a div element identified by its *:id* attribute.
|
334
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
335
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
336
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
337
|
-
# @param [Boolean] dbg Triggers additional debug logging when set to true.
|
338
|
-
# @return [Water::Div]
|
339
|
-
def get_div_by_id(browser, what, desc = '', dbg = false)
|
340
|
-
get_div(browser, :id, what, desc, dbg)
|
341
|
-
end
|
342
|
-
|
343
|
-
# Return a reference to a div element identified by its *:class* attribute.
|
344
|
-
# @param (see #get_div_by_id)
|
345
|
-
# @return [Water::Div]
|
346
|
-
def get_div_by_class(browser, what, desc = '', dbg = false)
|
347
|
-
get_div(browser, :class, what, desc, dbg)
|
348
|
-
end
|
349
|
-
|
350
|
-
# Return a reference to a div element identified by its *:text* attribute.
|
351
|
-
# @param (see #get_div_by_id)
|
352
|
-
# @return [Water::Div]
|
353
|
-
def get_div_by_text(browser, what, desc = '', dbg = false)
|
354
|
-
get_div(browser, :text, what, desc, dbg)
|
355
|
-
end
|
356
|
-
|
357
|
-
# Return a reference to a form element identified by its *:id* attribute.
|
358
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
359
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the designated attribute that uniquely identifies the element.
|
360
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
361
|
-
# @return [Water::Form]
|
362
|
-
def get_form_by_id(browser, what, desc = '')
|
363
|
-
get_form(browser, :id, what, desc)
|
364
|
-
end
|
365
|
-
|
366
|
-
# Return a reference to a frame element identified by its *:id* attribute.
|
367
|
-
# @param (see #get_form_by_id)
|
368
|
-
# @return [Water::Frame]
|
369
|
-
def get_frame_by_id(browser, what, desc = '')
|
370
|
-
get_frame(browser, :id, what, desc)
|
371
|
-
end
|
372
|
-
|
373
|
-
# Return a reference to a frame element identified by its *:index* within *browser*.
|
374
|
-
# @param (see #get_form_by_id)
|
375
|
-
# @return [Water::Frame]
|
376
|
-
def get_frame_by_index(browser, what, desc = '')
|
377
|
-
get_frame(browser, :index, what, desc)
|
378
|
-
end
|
379
|
-
|
380
|
-
# Return a reference to a frame element identified by its *:name* attribute.
|
381
|
-
# @param (see #get_form_by_id)
|
382
|
-
# @return [Water::Frame]
|
383
|
-
def get_frame_by_name(browser, what, desc = '')
|
384
|
-
get_frame(browser, :name, what, desc)
|
385
|
-
end
|
386
|
-
|
387
|
-
# Return a reference to a span element identified by its *:id* attribute.
|
388
|
-
# @param (see #get_form_by_id)
|
389
|
-
# @return [Water::Span]
|
390
|
-
def get_span_by_id(browser, what, desc = '')
|
391
|
-
get_span(browser, :id, what, desc)
|
392
|
-
end
|
393
|
-
|
394
|
-
# Return a reference to a table element identified by its attribute *how* containing *what*.
|
395
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
396
|
-
# @param [Symbol] how The element attribute used to identify the specific element.
|
397
|
-
# Valid values depend on the kind of element.
|
398
|
-
# Common values: :text, :id, :title, :name, :class, :href (:link only)
|
399
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
400
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
401
|
-
# @return [Watir::Table]
|
402
|
-
def get_table(browser, how, what, desc = '')
|
403
|
-
get_element(browser, :table, how, what, nil, desc)
|
404
|
-
end
|
405
|
-
|
406
|
-
# Return a reference to a table element identified by its *:id* attribute.
|
407
|
-
# @param [Watir::Browser] browser A reference to the browser window or container element to be tested.
|
408
|
-
# @param [String, Regexp] what A string or a regular expression to be found in the *how* attribute that uniquely identifies the element.
|
409
|
-
# @param [String] desc Contains a message or description intended to appear in the log and/or report output
|
410
|
-
# @return [Watir::Table]
|
411
|
-
def get_table_by_id(browser, what, desc = '')
|
412
|
-
get_element(browser, :table, :id, what, nil, desc)
|
413
|
-
end
|
414
|
-
|
415
|
-
# Return a reference to a table element identified by its *:index* within *browser*.
|
416
|
-
# @param (see #get_table)
|
417
|
-
# @return [Watir::Table]
|
418
|
-
def get_table_by_index(browser, what, desc = '')
|
419
|
-
get_element(browser, :table, :index, what, nil, desc)
|
420
|
-
end
|
421
|
-
|
422
|
-
# Return a reference to a table element identified by its *:text* attribute.
|
423
|
-
# @param (see #get_table)
|
424
|
-
# @return [Watir::Table]
|
425
|
-
def get_table_by_text(browser, what)
|
426
|
-
get_element(browser, :table, :text, what, nil, desc)
|
427
|
-
end
|
428
|
-
|
429
|
-
# @!endgroup Legacy
|
430
|
-
|
431
313
|
# @!group Deprecated
|
432
314
|
|
433
315
|
# Find the index of an element within *browser* which has attribute *how* containing *what*
|