watir 1.5.6 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{changes.rb → CHANGES} +12 -3
- data/bin/watir-console +7 -1
- data/lib/changes.rb +3 -0
- data/{license.rb → lib/license.rb} +2 -1
- data/{readme.rb → lib/readme.rb} +4 -6
- data/{watir → lib/watir}/AutoItX3.dll +0 -0
- data/{watir → lib/watir}/IEDialog/Release/IEDialog.dll +0 -0
- data/{watir → lib/watir}/WindowHelper.rb +1 -1
- data/{watir → lib/watir}/camel_case.rb +0 -0
- data/{watir → lib/watir}/clickJSDialog.rb +0 -0
- data/{watir → lib/watir}/close_all.rb +1 -1
- data/{watir → lib/watir}/collections.rb +1 -1
- data/{watir → lib/watir}/container.rb +17 -8
- data/{watir → lib/watir}/contrib/enabled_popup.rb +0 -0
- data/{watir → lib/watir}/contrib/ie-new-process.rb +0 -0
- data/{watir → lib/watir}/contrib/page_checker.rb +0 -0
- data/{watir → lib/watir}/contrib/visible.rb +2 -2
- data/{watir → lib/watir}/cookiemanager.rb +0 -0
- data/{watir → lib/watir}/datahandler.rb +0 -0
- data/{watir → lib/watir}/dialog.rb +1 -1
- data/{watir → lib/watir}/element.rb +3 -7
- data/{watir → lib/watir}/element_collections.rb +0 -0
- data/{watir → lib/watir}/form.rb +31 -11
- data/{watir → lib/watir}/frame.rb +0 -0
- data/{watir/ie.rb → lib/watir/ie-class.rb} +22 -22
- data/{watir → lib/watir}/ie-process.rb +0 -0
- data/{watir.rb → lib/watir/ie.rb} +11 -27
- data/{watir → lib/watir}/image.rb +0 -0
- data/{watir → lib/watir}/input_elements.rb +33 -44
- data/{watir → lib/watir}/irb-history.rb +0 -0
- data/{watir → lib/watir}/link.rb +0 -0
- data/{watir → lib/watir}/locator.rb +56 -43
- data/{watir → lib/watir}/logger.rb +0 -0
- data/{watir → lib/watir}/modal_dialog.rb +0 -0
- data/{watir → lib/watir}/non_control_elements.rb +0 -0
- data/{watir → lib/watir}/page-container.rb +2 -2
- data/{watir → lib/watir}/popup.rb +0 -0
- data/{watir → lib/watir}/process.rb +0 -0
- data/{watir → lib/watir}/screen_capture.rb +0 -0
- data/{watir → lib/watir}/setFileDialog.rb +0 -0
- data/{watir → lib/watir}/table.rb +7 -2
- data/{watir → lib/watir}/utils.rb +0 -0
- data/lib/watir/version.rb +5 -0
- data/{watir → lib/watir}/watir_simple.rb +3 -3
- data/{watir → lib/watir}/win32.rb +0 -0
- data/lib/watir/win32ole.rb +6 -0
- data/lib/watir/win32ole/win32ole.so +0 -0
- data/{watir → lib/watir}/winClicker.rb +0 -0
- data/unittests/buttons_xpath_test.rb +32 -32
- data/unittests/checkbox_test.rb +113 -99
- data/unittests/checkbox_xpath_test.rb +57 -57
- data/unittests/core_tests.rb +10 -7
- data/unittests/css_test.rb +12 -32
- data/unittests/defer_test.rb +22 -22
- data/unittests/dialog_test.rb +13 -13
- data/unittests/div2_xpath_test.rb +3 -3
- data/unittests/div_test.rb +23 -19
- data/unittests/div_xpath_test.rb +50 -50
- data/unittests/errorchecker_test.rb +7 -9
- data/unittests/filefield_test.rb +12 -11
- data/unittests/filefield_xpath_test.rb +10 -10
- data/unittests/form_test.rb +144 -151
- data/unittests/form_xpath_test.rb +99 -99
- data/unittests/frame_test.rb +46 -44
- data/unittests/google_form_test.rb +2 -2
- data/unittests/html/checkboxes1.html +19 -16
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/wallofcheckboxes.html +1003 -0
- data/unittests/ie_exists_test.rb +5 -3
- data/unittests/ie_test.rb +2 -2
- data/unittests/images_test.rb +83 -82
- data/unittests/images_xpath_test.rb +40 -40
- data/unittests/iostring_test.rb +1 -1
- data/unittests/links_multi_test.rb +7 -8
- data/unittests/links_test.rb +73 -71
- data/unittests/links_xpath_test.rb +15 -15
- data/unittests/lists_test.rb +10 -10
- data/unittests/map_test.rb +65 -65
- data/unittests/minmax_test.rb +10 -9
- data/unittests/navigate_test.rb +19 -23
- data/unittests/nbsp_xpath_test.rb +2 -2
- data/unittests/non_core_tests.rb +5 -2
- data/unittests/other/WindowLogonExample.rb +2 -2
- data/unittests/other/WindowLogonExtra.rb +1 -1
- data/unittests/other/navigate_exception_test.rb +14 -3
- data/unittests/other/screen_capture_test.rb +3 -2
- data/unittests/other/testcase_method_order_test.rb +1 -1
- data/unittests/pagecontainstext_test.rb +17 -14
- data/unittests/parent_child_test.rb +11 -7
- data/unittests/perf_test.rb +20 -0
- data/unittests/popups_test.rb +13 -14
- data/unittests/pre_test.rb +30 -28
- data/unittests/radios_test.rb +128 -107
- data/unittests/radios_xpath_test.rb +47 -47
- data/unittests/security_setting_test.rb +24 -0
- data/unittests/selectbox_test.rb +65 -157
- data/unittests/selectbox_xpath_test.rb +51 -51
- data/unittests/setup.rb +52 -48
- data/unittests/speed_settings_test.rb +31 -20
- data/unittests/table_cell_using_xpath_test.rb +12 -12
- data/unittests/table_test.rb +30 -16
- data/unittests/table_xpath_test.rb +25 -25
- data/unittests/test_tests.rb +9 -0
- data/unittests/textarea_test.rb +33 -33
- data/unittests/textarea_xpath_test.rb +37 -37
- data/unittests/textfield_for_ch_char_test.rb +9 -9
- data/unittests/textfields_test.rb +103 -98
- data/unittests/textfields_xpath_test.rb +50 -50
- data/unittests/windows/attach_to_existing_window_test.rb +2 -2
- data/unittests/windows/attach_to_new_window_test.rb +10 -10
- data/unittests/windows/close_window_test.rb +2 -2
- data/unittests/windows/frame_links_test.rb +6 -6
- data/unittests/windows/ie-each_test.rb +1 -1
- data/unittests/windows/iedialog_test.rb +4 -5
- data/unittests/windows/js_events_test.rb +14 -14
- data/unittests/windows/jscriptExtraAlert.rb +2 -1
- data/unittests/windows/jscriptExtraConfirmCancel.rb +1 -1
- data/unittests/windows/jscriptExtraConfirmOk.rb +1 -1
- data/unittests/windows/jscriptPushButton.rb +2 -1
- data/unittests/windows/jscript_test.rb +7 -7
- data/unittests/windows/modal_dialog_test.rb +28 -29
- data/unittests/windows/{new.rb → new_test.rb} +1 -1
- data/unittests/windows/open_close_test.rb +4 -7
- data/unittests/windows/send_keys_test.rb +11 -11
- data/unittests/xpath_tests.rb +4 -3
- metadata +82 -58
- data/unittests/buttons_test.rb +0 -107
- data/watir/assertions.rb +0 -44
- data/watir/exceptions.rb +0 -42
- data/watir/testcase.rb +0 -58
- data/watir/waiter.rb +0 -88
- data/watir/win32ole.rb +0 -8
- data/watir/win32ole/win32ole.so +0 -0
File without changes
|
@@ -2,13 +2,7 @@ module Watir
|
|
2
2
|
|
3
3
|
class InputElement < Element
|
4
4
|
def locate
|
5
|
-
|
6
|
-
@o = @container.element_by_xpath(@what)
|
7
|
-
elsif @how == :ole_object
|
8
|
-
@o = @what
|
9
|
-
else
|
10
|
-
@o = @container.locate_input_element(@how, @what, self.class::INPUT_TYPES)
|
11
|
-
end
|
5
|
+
@o = @container.locate_input_element(@how, @what, self.class::INPUT_TYPES)
|
12
6
|
end
|
13
7
|
def initialize(container, how, what)
|
14
8
|
set_container container
|
@@ -118,18 +112,19 @@ module Watir
|
|
118
112
|
end
|
119
113
|
|
120
114
|
# Does the SelectList include the specified option (text)?
|
121
|
-
def includes?
|
122
|
-
getAllContents.
|
115
|
+
def includes? text_or_regexp
|
116
|
+
getAllContents.grep(text_or_regexp).size > 0
|
123
117
|
end
|
124
118
|
|
125
119
|
# Is the specified option (text) selected? Raises exception of option does not exist.
|
126
|
-
def selected?
|
127
|
-
unless includes?
|
128
|
-
raise UnknownObjectException, "Option #{
|
120
|
+
def selected? text_or_regexp
|
121
|
+
unless includes? text_or_regexp
|
122
|
+
raise UnknownObjectException, "Option #{text_or_regexp.inspect} not found."
|
129
123
|
end
|
130
|
-
|
124
|
+
|
125
|
+
getSelectedItems.grep(text_or_regexp).size > 0
|
131
126
|
end
|
132
|
-
|
127
|
+
|
133
128
|
def option(attribute, value)
|
134
129
|
assert_exists
|
135
130
|
Option.new(self, attribute, value)
|
@@ -456,21 +451,13 @@ module Watir
|
|
456
451
|
#
|
457
452
|
# most of the methods available to this element are inherited from the Element class
|
458
453
|
#
|
459
|
-
class RadioCheckCommon <
|
454
|
+
class RadioCheckCommon < InputElement
|
460
455
|
def locate
|
461
|
-
|
462
|
-
@o = @container.element_by_xpath(@what)
|
463
|
-
else
|
464
|
-
@o = @container.locate_input_element(@how, @what, @type, @value)
|
465
|
-
end
|
456
|
+
@o = @container.locate_input_element(@how, @what, self.class::INPUT_TYPES, @value)
|
466
457
|
end
|
467
|
-
def initialize(container, how, what,
|
468
|
-
|
469
|
-
@how = how
|
470
|
-
@what = what
|
471
|
-
@type = type
|
458
|
+
def initialize(container, how, what, value=nil)
|
459
|
+
super container, how, what
|
472
460
|
@value = value
|
473
|
-
super(nil)
|
474
461
|
end
|
475
462
|
|
476
463
|
# BUG: rename me
|
@@ -484,7 +471,23 @@ module Watir
|
|
484
471
|
alias getState isSet?
|
485
472
|
alias checked? isSet?
|
486
473
|
|
487
|
-
# This method
|
474
|
+
# This method is the common code for setting or clearing checkboxes and radio.
|
475
|
+
def set_clear_item(set)
|
476
|
+
@o.checked = set
|
477
|
+
@o.fireEvent("onClick")
|
478
|
+
@container.wait
|
479
|
+
end
|
480
|
+
private :set_clear_item
|
481
|
+
|
482
|
+
end
|
483
|
+
|
484
|
+
#--
|
485
|
+
# this class makes the docs better
|
486
|
+
#++
|
487
|
+
# This class is the watir representation of a radio button.
|
488
|
+
class Radio < RadioCheckCommon
|
489
|
+
INPUT_TYPES = ["radio"]
|
490
|
+
# This method clears a radio button. One of them will almost always be set.
|
488
491
|
# Returns true if set or false if not set.
|
489
492
|
# Raises UnknownObjectException if its unable to locate an object
|
490
493
|
# ObjectDisabledException IF THE OBJECT IS DISABLED
|
@@ -495,36 +498,22 @@ module Watir
|
|
495
498
|
highlight(:clear)
|
496
499
|
end
|
497
500
|
|
498
|
-
# This method sets the radio list item
|
501
|
+
# This method sets the radio list item.
|
499
502
|
# Raises UnknownObjectException if it's unable to locate an object
|
500
503
|
# ObjectDisabledException if the object is disabled
|
501
504
|
def set
|
502
505
|
assert_enabled
|
503
506
|
highlight(:set)
|
507
|
+
@o.scrollIntoView
|
504
508
|
set_clear_item(true)
|
505
509
|
highlight(:clear)
|
506
510
|
end
|
507
511
|
|
508
|
-
# This method is the common code for setting or clearing checkboxes and radio.
|
509
|
-
def set_clear_item(set)
|
510
|
-
@o.checked = set
|
511
|
-
@o.fireEvent("onClick")
|
512
|
-
@container.wait
|
513
|
-
end
|
514
|
-
private :set_clear_item
|
515
|
-
|
516
|
-
end
|
517
|
-
|
518
|
-
#--
|
519
|
-
# this class makes the docs better
|
520
|
-
#++
|
521
|
-
# This class is the watir representation of a radio button.
|
522
|
-
class Radio < RadioCheckCommon
|
523
512
|
end
|
524
513
|
|
525
514
|
# This class is the watir representation of a check box.
|
526
515
|
class CheckBox < RadioCheckCommon
|
527
|
-
|
516
|
+
INPUT_TYPES = ["checkbox"]
|
528
517
|
# With no arguments supplied, sets the check box.
|
529
518
|
# If the optional value is supplied, the checkbox is set, when its true and
|
530
519
|
# cleared when its false
|
File without changes
|
data/{watir → lib/watir}/link.rb
RENAMED
File without changes
|
@@ -34,8 +34,6 @@ module Watir
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def locate
|
37
|
-
index_target = @specifiers[:index]
|
38
|
-
|
39
37
|
count = 0
|
40
38
|
each_element(@tag) do |element|
|
41
39
|
|
@@ -47,7 +45,7 @@ module Watir
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
count += 1
|
50
|
-
unless
|
48
|
+
unless count == @specifiers[:index]
|
51
49
|
throw :next_element
|
52
50
|
end
|
53
51
|
return element.ole_object
|
@@ -85,43 +83,56 @@ module Watir
|
|
85
83
|
end
|
86
84
|
def specifier= arg
|
87
85
|
how, what, value = arg
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
86
|
+
|
87
|
+
if how.class == Hash and what.nil?
|
88
|
+
specifiers = how
|
89
|
+
else
|
90
|
+
specifiers = {how => what}
|
91
|
+
end
|
92
|
+
|
93
|
+
@specifiers = {:index => 1} # default if not specified
|
94
|
+
@specifiers[:value] = value.to_s if value
|
95
|
+
specifiers.each do | how, what |
|
96
|
+
how = :value if how == :caption
|
97
|
+
how = :class_name if how == :class
|
98
|
+
what = what.to_i if how == :index
|
99
|
+
@specifiers[how] = what
|
100
|
+
end
|
95
101
|
end
|
102
|
+
|
96
103
|
def locate
|
97
|
-
|
104
|
+
count = 0
|
98
105
|
@elements.each do |object|
|
99
106
|
element = Element.new(object)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
raise MissingWayOfFindingObjectException,
|
108
|
-
"#{@how} is an unknown way of finding an <INPUT> element (#{@what})"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
if @what.matches(attribute)
|
112
|
-
if @value
|
113
|
-
if element.value == @value
|
114
|
-
return object
|
115
|
-
end
|
116
|
-
else
|
117
|
-
return object
|
107
|
+
|
108
|
+
catch :next_element do
|
109
|
+
throw :next_element unless @types.include?(element.type)
|
110
|
+
@specifiers.each do |how, what|
|
111
|
+
next if how == :index
|
112
|
+
unless match? element, how, what
|
113
|
+
throw :next_element
|
118
114
|
end
|
119
115
|
end
|
120
|
-
|
116
|
+
count += 1
|
117
|
+
throw :next_element unless count == @specifiers[:index]
|
118
|
+
return object
|
121
119
|
end
|
120
|
+
|
122
121
|
end
|
123
|
-
|
122
|
+
nil
|
124
123
|
end
|
124
|
+
# return true if the element matches the provided how and what
|
125
|
+
def match? element, how, what
|
126
|
+
begin
|
127
|
+
attribute = element.send(how)
|
128
|
+
rescue NoMethodError
|
129
|
+
raise MissingWayOfFindingObjectException,
|
130
|
+
"#{how} is an unknown way of finding an <INPUT> element (#{what})"
|
131
|
+
end
|
132
|
+
|
133
|
+
what.matches(attribute)
|
134
|
+
end
|
135
|
+
|
125
136
|
def fast_locate
|
126
137
|
# Searching through all elements returned by ole_inner_elements
|
127
138
|
# is *significantly* slower than IE's getElementById() and
|
@@ -131,18 +142,20 @@ module Watir
|
|
131
142
|
# where the :name matches, so we will only return the results of
|
132
143
|
# getElementById() if the matching element actually HAS a matching
|
133
144
|
# :id.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
145
|
+
|
146
|
+
the_id = @specifiers[:id]
|
147
|
+
if the_id && the_id.class == String &&
|
148
|
+
@specifiers[:index] == 1 && @specifiers.length == 2
|
149
|
+
@element = @document.getElementById(the_id) rescue nil
|
150
|
+
# Return if our fast match really HAS a matching :id
|
151
|
+
return true if @element && @element.invoke('id') == the_id
|
152
|
+
end
|
153
|
+
|
154
|
+
the_name = @specifiers[:name]
|
155
|
+
if the_name && the_name.class == String
|
156
|
+
@elements = @document.getElementsByName(the_name) rescue nil
|
157
|
+
end
|
158
|
+
false
|
146
159
|
end
|
147
160
|
end
|
148
161
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -12,7 +12,7 @@ module Watir
|
|
12
12
|
n = self.document.invoke('parentWindow').navigator.appVersion
|
13
13
|
m=/MSIE\s(.*?);/.match( n )
|
14
14
|
if m and m[1] =='7.0'
|
15
|
-
if m
|
15
|
+
if m = /HTTP (\d\d\d.*)/.match( self.title )
|
16
16
|
raise NavigationException, m[1]
|
17
17
|
end
|
18
18
|
else
|
@@ -50,7 +50,7 @@ module Watir
|
|
50
50
|
def eval_in_spawned_process(command)
|
51
51
|
command.strip!
|
52
52
|
load_path_code = _code_that_copies_readonly_array($LOAD_PATH, '$LOAD_PATH')
|
53
|
-
ruby_code = "require 'watir'; "
|
53
|
+
ruby_code = "require 'watir/ie'; "
|
54
54
|
# ruby_code = "$HIDE_IE = #{$HIDE_IE};" # This prevents attaching to a window from setting it visible. However modal dialogs cannot be attached to when not visible.
|
55
55
|
ruby_code << "pc = #{attach_command}; " # pc = page container
|
56
56
|
# IDEA: consider changing this to not use instance_eval (it makes the code hard to understand)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -99,13 +99,18 @@ module Watir
|
|
99
99
|
return TableRow.new(@container, :ole_object, _row(index))
|
100
100
|
end
|
101
101
|
|
102
|
-
#
|
103
|
-
# Raises an UnknownObjectException if the table doesnt exist.
|
102
|
+
# Returns the number of rows inside the table, including rows in nested tables.
|
104
103
|
def row_count
|
105
104
|
assert_exists
|
106
105
|
#return table_body.children.length
|
107
106
|
return @o.getElementsByTagName("TR").length
|
108
107
|
end
|
108
|
+
|
109
|
+
# Returns the number of rows in the table, not including rows in nested tables.
|
110
|
+
def row_count_excluding_nested_tables
|
111
|
+
assert_exists
|
112
|
+
return @o.rows.length
|
113
|
+
end
|
109
114
|
|
110
115
|
# This method returns the number of columns in a row of the table.
|
111
116
|
# Raises an UnknownObjectException if the table doesn't exist.
|
File without changes
|
@@ -49,7 +49,7 @@ module Watir
|
|
49
49
|
# Most action methods in Watir::Simple will automatically wait for the browser
|
50
50
|
# not to be busy before and after they perform the specified action.
|
51
51
|
#
|
52
|
-
# revision: $Revision:
|
52
|
+
# revision: $Revision: 1505 $
|
53
53
|
module Simple
|
54
54
|
|
55
55
|
# Open up a browser and point it at a certain URL.
|
@@ -259,9 +259,9 @@ module Watir
|
|
259
259
|
# * mesg - An assertion-failed message.
|
260
260
|
def assert_text_not_in_body(text,mesg=nil)
|
261
261
|
if mesg.nil? then
|
262
|
-
|
262
|
+
assert_false( @@browser.pageContainsText(text), "found in body: [#{text}]")
|
263
263
|
else
|
264
|
-
|
264
|
+
assert_false( @@browser.pageContainsText(text), mesg)
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
File without changes
|
Binary file
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Buttons
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Buttons_XPath < Test::Unit::TestCase
|
@@ -12,58 +12,58 @@ class TC_Buttons_XPath < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_properties
|
15
|
-
assert_raises(UnknownObjectException
|
16
|
-
assert_raises(UnknownObjectException
|
17
|
-
assert_raises(UnknownObjectException
|
18
|
-
assert_raises(UnknownObjectException
|
19
|
-
assert_raises(UnknownObjectException
|
15
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").id }
|
16
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").name }
|
17
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").disabled }
|
18
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").type }
|
19
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").value }
|
20
20
|
|
21
|
-
assert_equal("b1" ,
|
22
|
-
assert_equal("b2" ,
|
23
|
-
assert_equal("button" ,
|
21
|
+
assert_equal("b1" , browser.button(:xpath, "//input[@id='b2']/").name )
|
22
|
+
assert_equal("b2" , browser.button(:xpath, "//input[@id='b2']/").id )
|
23
|
+
assert_equal("button" , browser.button(:xpath, "//input[@id='b2']/").type )
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_button_using_default
|
27
27
|
# since most of the time, a button will be accessed based on its caption, there is a default way of accessing it....
|
28
|
-
assert_raises(UnknownObjectException
|
28
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']/").click }
|
29
29
|
|
30
|
-
|
31
|
-
assert(
|
30
|
+
browser.button(:xpath, "//input[@value='Click Me']/").click
|
31
|
+
assert(browser.text.include?("PASS") )
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_Button_click_only
|
35
|
-
|
36
|
-
assert(
|
35
|
+
browser.button(:xpath, "//input[@value='Click Me']/").click
|
36
|
+
assert(browser.text.include?("PASS") )
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_button_click
|
40
|
-
assert_raises(UnknownObjectException
|
41
|
-
assert_raises(UnknownObjectException
|
40
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']/").click }
|
41
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@id='MissingId']/").click }
|
42
42
|
|
43
|
-
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) {
|
43
|
+
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.button(:xpath, "//input[@value='Disabled Button']/").click }
|
44
44
|
|
45
|
-
|
46
|
-
assert(
|
45
|
+
browser.button(:xpath, "//input[@value='Click Me']/").click
|
46
|
+
assert(browser.text.include?("PASS") )
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_Button_Exists
|
50
|
-
assert(
|
51
|
-
assert(
|
52
|
-
assert(
|
53
|
-
assert(
|
50
|
+
assert(browser.button(:xpath, "//input[@value='Click Me']/").exists?)
|
51
|
+
assert(browser.button(:xpath, "//input[@value='Submit']/").exists?)
|
52
|
+
assert(browser.button(:xpath, "//input[@name='b1']/").exists?)
|
53
|
+
assert(browser.button(:xpath, "//input[@id='b2']/").exists?)
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
assert_false(browser.button(:xpath, "//input[@value='Missing Caption']/").exists?)
|
56
|
+
assert_false(browser.button(:xpath, "//input[@name='missingname']/").exists?)
|
57
|
+
assert_false(browser.button(:xpath, "//input[@id='missingid']/").exists?)
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_Button_Enabled
|
61
|
-
assert(
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
assert(browser.button(:xpath, "//input[@value='Click Me']/").enabled?)
|
62
|
+
assert_false(browser.button(:xpath, "//input[@value='Disabled Button']/").enabled?)
|
63
|
+
assert_false(browser.button(:xpath, "//input[@name='b4']/").enabled?)
|
64
|
+
assert_false(browser.button(:xpath, "//input[@id='b5']/").enabled?)
|
65
65
|
|
66
|
-
assert_raises(UnknownObjectException
|
66
|
+
assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").enabled? }
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|