watir 1.5.6 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/{changes.rb → CHANGES} +12 -3
  2. data/bin/watir-console +7 -1
  3. data/lib/changes.rb +3 -0
  4. data/{license.rb → lib/license.rb} +2 -1
  5. data/{readme.rb → lib/readme.rb} +4 -6
  6. data/{watir → lib/watir}/AutoItX3.dll +0 -0
  7. data/{watir → lib/watir}/IEDialog/Release/IEDialog.dll +0 -0
  8. data/{watir → lib/watir}/WindowHelper.rb +1 -1
  9. data/{watir → lib/watir}/camel_case.rb +0 -0
  10. data/{watir → lib/watir}/clickJSDialog.rb +0 -0
  11. data/{watir → lib/watir}/close_all.rb +1 -1
  12. data/{watir → lib/watir}/collections.rb +1 -1
  13. data/{watir → lib/watir}/container.rb +17 -8
  14. data/{watir → lib/watir}/contrib/enabled_popup.rb +0 -0
  15. data/{watir → lib/watir}/contrib/ie-new-process.rb +0 -0
  16. data/{watir → lib/watir}/contrib/page_checker.rb +0 -0
  17. data/{watir → lib/watir}/contrib/visible.rb +2 -2
  18. data/{watir → lib/watir}/cookiemanager.rb +0 -0
  19. data/{watir → lib/watir}/datahandler.rb +0 -0
  20. data/{watir → lib/watir}/dialog.rb +1 -1
  21. data/{watir → lib/watir}/element.rb +3 -7
  22. data/{watir → lib/watir}/element_collections.rb +0 -0
  23. data/{watir → lib/watir}/form.rb +31 -11
  24. data/{watir → lib/watir}/frame.rb +0 -0
  25. data/{watir/ie.rb → lib/watir/ie-class.rb} +22 -22
  26. data/{watir → lib/watir}/ie-process.rb +0 -0
  27. data/{watir.rb → lib/watir/ie.rb} +11 -27
  28. data/{watir → lib/watir}/image.rb +0 -0
  29. data/{watir → lib/watir}/input_elements.rb +33 -44
  30. data/{watir → lib/watir}/irb-history.rb +0 -0
  31. data/{watir → lib/watir}/link.rb +0 -0
  32. data/{watir → lib/watir}/locator.rb +56 -43
  33. data/{watir → lib/watir}/logger.rb +0 -0
  34. data/{watir → lib/watir}/modal_dialog.rb +0 -0
  35. data/{watir → lib/watir}/non_control_elements.rb +0 -0
  36. data/{watir → lib/watir}/page-container.rb +2 -2
  37. data/{watir → lib/watir}/popup.rb +0 -0
  38. data/{watir → lib/watir}/process.rb +0 -0
  39. data/{watir → lib/watir}/screen_capture.rb +0 -0
  40. data/{watir → lib/watir}/setFileDialog.rb +0 -0
  41. data/{watir → lib/watir}/table.rb +7 -2
  42. data/{watir → lib/watir}/utils.rb +0 -0
  43. data/lib/watir/version.rb +5 -0
  44. data/{watir → lib/watir}/watir_simple.rb +3 -3
  45. data/{watir → lib/watir}/win32.rb +0 -0
  46. data/lib/watir/win32ole.rb +6 -0
  47. data/lib/watir/win32ole/win32ole.so +0 -0
  48. data/{watir → lib/watir}/winClicker.rb +0 -0
  49. data/unittests/buttons_xpath_test.rb +32 -32
  50. data/unittests/checkbox_test.rb +113 -99
  51. data/unittests/checkbox_xpath_test.rb +57 -57
  52. data/unittests/core_tests.rb +10 -7
  53. data/unittests/css_test.rb +12 -32
  54. data/unittests/defer_test.rb +22 -22
  55. data/unittests/dialog_test.rb +13 -13
  56. data/unittests/div2_xpath_test.rb +3 -3
  57. data/unittests/div_test.rb +23 -19
  58. data/unittests/div_xpath_test.rb +50 -50
  59. data/unittests/errorchecker_test.rb +7 -9
  60. data/unittests/filefield_test.rb +12 -11
  61. data/unittests/filefield_xpath_test.rb +10 -10
  62. data/unittests/form_test.rb +144 -151
  63. data/unittests/form_xpath_test.rb +99 -99
  64. data/unittests/frame_test.rb +46 -44
  65. data/unittests/google_form_test.rb +2 -2
  66. data/unittests/html/checkboxes1.html +19 -16
  67. data/unittests/html/forms3.html +2 -2
  68. data/unittests/html/wallofcheckboxes.html +1003 -0
  69. data/unittests/ie_exists_test.rb +5 -3
  70. data/unittests/ie_test.rb +2 -2
  71. data/unittests/images_test.rb +83 -82
  72. data/unittests/images_xpath_test.rb +40 -40
  73. data/unittests/iostring_test.rb +1 -1
  74. data/unittests/links_multi_test.rb +7 -8
  75. data/unittests/links_test.rb +73 -71
  76. data/unittests/links_xpath_test.rb +15 -15
  77. data/unittests/lists_test.rb +10 -10
  78. data/unittests/map_test.rb +65 -65
  79. data/unittests/minmax_test.rb +10 -9
  80. data/unittests/navigate_test.rb +19 -23
  81. data/unittests/nbsp_xpath_test.rb +2 -2
  82. data/unittests/non_core_tests.rb +5 -2
  83. data/unittests/other/WindowLogonExample.rb +2 -2
  84. data/unittests/other/WindowLogonExtra.rb +1 -1
  85. data/unittests/other/navigate_exception_test.rb +14 -3
  86. data/unittests/other/screen_capture_test.rb +3 -2
  87. data/unittests/other/testcase_method_order_test.rb +1 -1
  88. data/unittests/pagecontainstext_test.rb +17 -14
  89. data/unittests/parent_child_test.rb +11 -7
  90. data/unittests/perf_test.rb +20 -0
  91. data/unittests/popups_test.rb +13 -14
  92. data/unittests/pre_test.rb +30 -28
  93. data/unittests/radios_test.rb +128 -107
  94. data/unittests/radios_xpath_test.rb +47 -47
  95. data/unittests/security_setting_test.rb +24 -0
  96. data/unittests/selectbox_test.rb +65 -157
  97. data/unittests/selectbox_xpath_test.rb +51 -51
  98. data/unittests/setup.rb +52 -48
  99. data/unittests/speed_settings_test.rb +31 -20
  100. data/unittests/table_cell_using_xpath_test.rb +12 -12
  101. data/unittests/table_test.rb +30 -16
  102. data/unittests/table_xpath_test.rb +25 -25
  103. data/unittests/test_tests.rb +9 -0
  104. data/unittests/textarea_test.rb +33 -33
  105. data/unittests/textarea_xpath_test.rb +37 -37
  106. data/unittests/textfield_for_ch_char_test.rb +9 -9
  107. data/unittests/textfields_test.rb +103 -98
  108. data/unittests/textfields_xpath_test.rb +50 -50
  109. data/unittests/windows/attach_to_existing_window_test.rb +2 -2
  110. data/unittests/windows/attach_to_new_window_test.rb +10 -10
  111. data/unittests/windows/close_window_test.rb +2 -2
  112. data/unittests/windows/frame_links_test.rb +6 -6
  113. data/unittests/windows/ie-each_test.rb +1 -1
  114. data/unittests/windows/iedialog_test.rb +4 -5
  115. data/unittests/windows/js_events_test.rb +14 -14
  116. data/unittests/windows/jscriptExtraAlert.rb +2 -1
  117. data/unittests/windows/jscriptExtraConfirmCancel.rb +1 -1
  118. data/unittests/windows/jscriptExtraConfirmOk.rb +1 -1
  119. data/unittests/windows/jscriptPushButton.rb +2 -1
  120. data/unittests/windows/jscript_test.rb +7 -7
  121. data/unittests/windows/modal_dialog_test.rb +28 -29
  122. data/unittests/windows/{new.rb → new_test.rb} +1 -1
  123. data/unittests/windows/open_close_test.rb +4 -7
  124. data/unittests/windows/send_keys_test.rb +11 -11
  125. data/unittests/xpath_tests.rb +4 -3
  126. metadata +82 -58
  127. data/unittests/buttons_test.rb +0 -107
  128. data/watir/assertions.rb +0 -44
  129. data/watir/exceptions.rb +0 -42
  130. data/watir/testcase.rb +0 -58
  131. data/watir/waiter.rb +0 -88
  132. data/watir/win32ole.rb +0 -8
  133. 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
- if @how == :xpath
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? text
122
- getAllContents.include? text
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? text
127
- unless includes? text
128
- raise UnknownObjectException, "Option #{text} not found."
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
- getSelectedItems.include? text
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 < Element
454
+ class RadioCheckCommon < InputElement
460
455
  def locate
461
- if @how == :xpath
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, type, value=nil)
468
- set_container container
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 clears a radio button or check box. Note, with radio buttons one of them will almost always be set.
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 or check box.
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
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 index_target == count
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
- how = :value if how == :caption
89
- how = :class_name if how == :class
90
- what = what.to_i if how == :index
91
- value = value.to_s if value
92
- @how = how
93
- @what = what
94
- @value = value
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
- object_index = 1
104
+ count = 0
98
105
  @elements.each do |object|
99
106
  element = Element.new(object)
100
- if @types.include?(element.type)
101
- if @how == :index
102
- attribute = object_index
103
- else
104
- begin
105
- attribute = element.send(@how)
106
- rescue NoMethodError
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
- object_index += 1
116
+ count += 1
117
+ throw :next_element unless count == @specifiers[:index]
118
+ return object
121
119
  end
120
+
122
121
  end
123
- return nil
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
- begin
135
- if @what.class == String # Only use fast calls with String what.
136
- if @how == :id
137
- @element = @document.getElementById(what)
138
- # Return if our fast match really HAS a matching :id
139
- return @element if @element.nil? or @element.invoke('id') == what
140
- elsif how == :name
141
- @elements = @document.getElementsByName(what)
142
- end
143
- end
144
- rescue
145
- end
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
@@ -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=/HTTP (\d\d\d.*)/.match( self.title )
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
- # This method returns the number of rows in the table.
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
@@ -0,0 +1,5 @@
1
+ module Watir
2
+ class IE
3
+ VERSION = '1.6.2'
4
+ end
5
+ end
@@ -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: 1007 $
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
- assert(! @@browser.pageContainsText(text), "found in body: [#{text}]")
262
+ assert_false( @@browser.pageContainsText(text), "found in body: [#{text}]")
263
263
  else
264
- assert(! @@browser.pageContainsText(text), mesg)
264
+ assert_false( @@browser.pageContainsText(text), mesg)
265
265
  end
266
266
  end
267
267
 
File without changes
@@ -0,0 +1,6 @@
1
+ # load the correct version of win32ole
2
+
3
+ # Use our modified win32ole library
4
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'watir', 'win32ole'))
5
+ require 'win32ole'
6
+
File without changes
@@ -1,7 +1,7 @@
1
1
  # feature tests for Buttons
2
- # revision: $Revision: 1348 $
2
+ # revision: $Revision: 1544 $
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __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 , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@name='noName']/").id }
16
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@name='noName']/").name }
17
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@name='noName']/").disabled }
18
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@name='noName']/").type }
19
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@name='noName']/").value }
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" , $ie.button(:xpath, "//input[@id='b2']/").name )
22
- assert_equal("b2" , $ie.button(:xpath, "//input[@id='b2']/").id )
23
- assert_equal("button" , $ie.button(:xpath, "//input[@id='b2']/").type )
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 , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@value='Missing Caption']/").click }
28
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@value='Missing Caption']/").click }
29
29
 
30
- $ie.button(:xpath, "//input[@value='Click Me']/").click
31
- assert($ie.text.include?("PASS") )
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
- $ie.button(:xpath, "//input[@value='Click Me']/").click
36
- assert($ie.text.include?("PASS") )
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 , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@value='Missing Caption']/").click }
41
- assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@id='MissingId']/").click }
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" ) { $ie.button(:xpath, "//input[@value='Disabled Button']/").click }
43
+ assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.button(:xpath, "//input[@value='Disabled Button']/").click }
44
44
 
45
- $ie.button(:xpath, "//input[@value='Click Me']/").click
46
- assert($ie.text.include?("PASS") )
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($ie.button(:xpath, "//input[@value='Click Me']/").exists?)
51
- assert($ie.button(:xpath, "//input[@value='Submit']/").exists?)
52
- assert($ie.button(:xpath, "//input[@name='b1']/").exists?)
53
- assert($ie.button(:xpath, "//input[@id='b2']/").exists?)
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
- assert(!$ie.button(:xpath, "//input[@value='Missing Caption']/").exists?)
56
- assert(!$ie.button(:xpath, "//input[@name='missingname']/").exists?)
57
- assert(!$ie.button(:xpath, "//input[@id='missingid']/").exists?)
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($ie.button(:xpath, "//input[@value='Click Me']/").enabled?)
62
- assert(!$ie.button(:xpath, "//input[@value='Disabled Button']/").enabled?)
63
- assert(!$ie.button(:xpath, "//input[@name='b4']/").enabled?)
64
- assert(!$ie.button(:xpath, "//input[@id='b5']/").enabled?)
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 , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:xpath, "//input[@name='noName']/").enabled? }
66
+ assert_raises(UnknownObjectException) { browser.button(:xpath, "//input[@name='noName']/").enabled? }
67
67
  end
68
68
  end
69
69