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
@@ -1,4 +1,15 @@
1
- =begin rdoc
1
+ == Watir 1.5.6
2
+
3
+ To install this:
4
+
5
+ "gem update --system"
6
+ "gem install watir"
7
+
8
+ Installer Fix
9
+
10
+ This update fixes an installer problem in Watir 1.5.5 that affected some users.
11
+ If you installed 1.5.5 without error, there is no reason to get this update.
12
+
2
13
  == Watir 1.5.5.
3
14
 
4
15
  New Features
@@ -175,5 +186,3 @@ Changes in 1.3
175
186
  bug fix in text_fields iterator where it wasnt iterating through password or text ares. Added test for password fields
176
187
  bug fix for flash for tables
177
188
  bug fixes for images and links in cells
178
-
179
- =end
@@ -1,2 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- exec 'irb.bat -r irb/completion -r watir/irb-history -r watir --simple-prompt --readline'
2
+ $root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
3
+ $watir_lib = File.join($root, 'watir', 'lib')
4
+ $watir_common_lib = File.join($root, 'watir-common', 'lib')
5
+ $firewatir_lib = File.join($root, 'firewatir', 'lib')
6
+ $libs = "-I #{$watir_lib} -I #{$watir_common_lib} -I #{$firewatir_lib}"
7
+ puts $libs
8
+ exec "irb.bat #{$libs} -r irb/completion -r watir/irb-history -r watir --simple-prompt --readline"
@@ -0,0 +1,3 @@
1
+ =begin rdoc
2
+ :include:../CHANGES
3
+ =end
@@ -2,7 +2,8 @@
2
2
 
3
3
  License
4
4
  ---------------------------------------------------------------------------
5
- Copyright (c) 2004-2007, Paul Rogers and Bret Pettichord
5
+ Copyright (c) 2004 - 2005, Paul Rogers and Bret Pettichord
6
+ Copyright (c) 2006 - 2008, Bret Pettichord
6
7
  All rights reserved.
7
8
 
8
9
  Redistribution and use in source and binary forms, with or without
@@ -4,12 +4,7 @@ This is Watir - Web Application Testing In Ruby http://wtr.rubyforge.org
4
4
 
5
5
  Install Ruby http://ruby-lang.org
6
6
  First you need to install Ruby using the one-click installer for Windows. We
7
- recommend Ruby 1.8.5. (Ruby 1.8.6 has problems.)
8
-
9
- However, if you wish to use Watir's support for the IE showModalDialog then
10
- you must use Ruby 1.8.2-15 (or 1.8.2-14) and not a more recent version. This
11
- dialog is the one that is posted with the showModalDialog() JavaScript
12
- command and is supported with Watir's ie.modal_dialog command.
7
+ recommend Ruby 1.8.6. (Even if you are using modal dialogs.)
13
8
 
14
9
  Install Watir
15
10
  Watir is packaged as a gem, a Ruby library that can be installed over the
@@ -127,6 +122,9 @@ Contributors:
127
122
  Paul Taylor - Bug fix 194
128
123
  Vincent Xu - Chinese input support
129
124
  Tomislav Car - Filefield fix (210)
125
+ Michael Hwee & Aidy Lewis - Multiple attribute support for FireWatir (233)
126
+ Alan Baird - Fix for visible? method (253)
127
+ Jari Bakken - Regexp support for includes? and selected? methods for select lists (261)
130
128
 
131
129
  Acknowledgements:
132
130
  Chris Morris
File without changes
@@ -1,5 +1,5 @@
1
1
  require 'watir/win32ole'
2
- require 'watir' # for Watir.autoit
2
+ require 'watir/ie' # for Watir.autoit
3
3
 
4
4
  class WindowHelper
5
5
  @@ie_window_name = "Windows Internet Explorer"
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- require 'watir'
1
+ require 'watir/ie'
2
2
 
3
3
  module Watir
4
4
  class IE
@@ -146,7 +146,7 @@ module Watir
146
146
  end
147
147
 
148
148
  class Lis < ElementCollections
149
- include Watir::CommonCollection
149
+ include CommonCollection
150
150
  def element_class; Li; end
151
151
 
152
152
  def set_show_items
@@ -50,7 +50,7 @@ module Watir
50
50
 
51
51
  # Determine the how and what when defaults are possible.
52
52
  def process_default(default_attribute, how, what)
53
- if how.class == String && what == nil
53
+ if what.nil? && String === how
54
54
  what = how
55
55
  how = default_attribute
56
56
  end
@@ -331,7 +331,7 @@ module Watir
331
331
  # ie.select_list(:name, /n_/) # access the first select box whose name matches n_
332
332
  # ie.select_list(:index, 2) # access the second select box on the page (1 based, so the first field is accessed with :index,1)
333
333
  # ie.select(:xpath, "//select[@id='currency']/") # access the select box with an id of currency
334
- def select_list(how, what)
334
+ def select_list(how, what=nil)
335
335
  SelectList.new(self, how, what)
336
336
  end
337
337
 
@@ -374,8 +374,8 @@ module Watir
374
374
  # ie.checkbox(:id, 'day_to_send', 'monday') # access the check box with an id of day_to_send and a value of monday
375
375
  # ie.checkbox(:name,'email_frequency', 'weekly') # access the check box with a name of email_frequency and a value of 'weekly'
376
376
  # ie.checkbox(:xpath, "//input[@name='email_frequency' and @value='daily']/") # access the checkbox with a name of email_frequency and a value of 'daily'
377
- def checkbox(how, what, value=nil)
378
- CheckBox.new(self, how, what, ["checkbox"], value)
377
+ def checkbox(how, what=nil, value=nil)
378
+ CheckBox.new(self, how, what, value)
379
379
  end
380
380
 
381
381
  # this is the method for accessing the check boxes iterator. Returns a CheckBoxes object
@@ -416,8 +416,8 @@ module Watir
416
416
  # ie.radio(:id, 'day_to_send', 'monday') # access the radio button with an id of day_to_send and a value of monday
417
417
  # ie.radio(:name,'email_frequency', 'weekly') # access the radio button with a name of email_frequency and a value of 'weekly'
418
418
  # ie.radio(:xpath, "//input[@name='email_frequency' and @value='daily']/") # access the radio button with a name of email_frequency and a value of 'daily'
419
- def radio(how, what, value=nil)
420
- Radio.new(self, how, what, ["radio"], value)
419
+ def radio(how, what=nil, value=nil)
420
+ Radio.new(self, how, what, value)
421
421
  end
422
422
 
423
423
  # This is the method for accessing the radio buttons iterator. Returns a Radios object
@@ -725,11 +725,20 @@ module Watir
725
725
  # * types - what object types we will look at.
726
726
  # * value - used for objects that have one name, but many values. ex. radio lists and checkboxes
727
727
  def locate_input_element(how, what, types, value=nil)
728
+ case how
729
+ when :xpath
730
+ return element_by_xpath(what)
731
+ when :ole_object
732
+ return what
733
+ end
734
+ # else:
735
+
728
736
  locator = InputElementLocator.new self, types
729
- locator.document = document rescue true
737
+ locator.specifier = [how, what, value]
738
+ locator.document = document
730
739
  return locator.element if locator.fast_locate
740
+ # todo: restrict search to elements.getElementsByTag('INPUT'); faster
731
741
  locator.elements = ole_inner_elements if locator.elements.nil?
732
- locator.specifier = [how, what, value]
733
742
  locator.locate
734
743
  end
735
744
 
@@ -29,10 +29,10 @@ class Watir::Element
29
29
  object = document
30
30
  while object
31
31
  begin
32
- if object.style.invoke('visibility') =~ /^hidden$/i
32
+ if object.currentstyle.invoke('visibility') =~ /^hidden$/i
33
33
  return false
34
34
  end
35
- if object.style.invoke('display') =~ /^none$/i
35
+ if object.currentstyle.invoke('display') =~ /^none$/i
36
36
  return false
37
37
  end
38
38
  if object.invoke('isDisabled')
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- require 'watir'
1
+ require 'watir/ie'
2
2
  # TODO: move this file to watir/contrib
3
3
 
4
4
  module Watir
@@ -41,19 +41,15 @@ module Watir
41
41
  end
42
42
  end"
43
43
  end
44
- # return a message indicating how the element is being located
45
- def located_using_message
46
- result = "using #{@how.inspect}"
47
- result << ", #{@what.inspect}" if @what
48
- result
49
- end
44
+
45
+
50
46
 
51
47
  public
52
48
  def assert_exists
53
49
  locate if defined?(locate)
54
50
  unless ole_object
55
51
  raise UnknownObjectException.new(
56
- "Unable to locate element, #{located_using_message}")
52
+ Watir::Exception.message_for_unable_to_locate(@how, @what))
57
53
  end
58
54
  end
59
55
  def assert_enabled
@@ -20,7 +20,7 @@ module Watir
20
20
  # wraps around a form OLE object
21
21
  class FormWrapper
22
22
  include FormAccess
23
- def initialize(ole_object)
23
+ def initialize ole_object
24
24
  @ole_object = ole_object
25
25
  end
26
26
  end
@@ -30,7 +30,7 @@ module Watir
30
30
  include FormAccess
31
31
  include Container
32
32
 
33
- attr_accessor :form
33
+ attr_accessor :form, :ole_object
34
34
 
35
35
  # * container - the containing object, normally an instance of IE
36
36
  # * how - symbol - how we access the form (:name, :id, :index, :action, :method)
@@ -52,9 +52,6 @@ module Watir
52
52
  next unless @ole_object == nil
53
53
 
54
54
  wrapped = FormWrapper.new(thisForm)
55
-
56
- log "form on page, name is " + wrapped.name
57
-
58
55
  @ole_object =
59
56
  case @how
60
57
  when :name, :id, :method, :action
@@ -64,7 +61,7 @@ module Watir
64
61
  else
65
62
  raise MissingWayOfFindingObjectException, "#{how} is an unknown way of finding a form (#{what})"
66
63
  end
67
- count = count +1
64
+ count += 1
68
65
  end
69
66
  end
70
67
  super(@ole_object)
@@ -77,15 +74,22 @@ module Watir
77
74
  end
78
75
  alias :exist? :exists?
79
76
 
77
+ def assert_exists
78
+ unless exists?
79
+ raise UnknownFormException,
80
+ "Unable to locate a form using #{@how} and #{@what}"
81
+ end
82
+ end
83
+
80
84
  # Submit the data -- equivalent to pressing Enter or Return to submit a form.
81
- def submit # XXX use assert_exists
82
- raise UnknownFormException, "Unable to locate a form using #{@how} and #{@what} " if @ole_object == nil
83
- @ole_object.submit
85
+ def submit
86
+ assert_exists
87
+ @ole_object.invoke('submit')
84
88
  @container.wait
85
89
  end
86
90
 
87
- def ole_inner_elements # XXX use assert_exists
88
- raise UnknownFormException, "Unable to locate a form using #{@how} and #{@what} " if @ole_object == nil
91
+ def ole_inner_elements
92
+ assert_exists
89
93
  @ole_object.elements
90
94
  end
91
95
  private :ole_inner_elements
@@ -148,4 +152,20 @@ module Watir
148
152
 
149
153
  end # class Form
150
154
 
155
+ end
156
+
157
+ module Watir
158
+ class Forms < ElementCollections
159
+ def element_class; Form; end
160
+ def element_tag; 'FORM'; end
161
+ def length
162
+ @container.document.getElementsByTagName("FORM").length
163
+ end
164
+ end
165
+
166
+ module Container
167
+ def forms
168
+ Forms.new(self)
169
+ end
170
+ end
151
171
  end
File without changes
@@ -4,9 +4,6 @@ module Watir
4
4
  include Container
5
5
  include PageContainer
6
6
 
7
- def self.quit
8
- end
9
-
10
7
  # Maximum number of seconds to wait when attaching to a window
11
8
  def self.reset_attach_timeout
12
9
  @@attach_timeout = 2.0
@@ -19,10 +16,13 @@ module Watir
19
16
  @@attach_timeout = timeout
20
17
  end
21
18
 
22
- def self.defaults
19
+ # Return the options used when creating new instances of IE.
20
+ # BUG: this interface invites misunderstanding/misuse such as IE.options[:speed] = :zippy]
21
+ def self.options
23
22
  {:speed => self.speed, :visible => self.visible}
24
- end
25
- def self.defaults= options
23
+ end
24
+ # set values for options used when creating new instances of IE.
25
+ def self.set_options options
26
26
  options.each do |name, value|
27
27
  send "#{name}=", value
28
28
  end
@@ -51,15 +51,6 @@ module Watir
51
51
  @@visible = x
52
52
  end
53
53
 
54
- # The revision number (according to Subversion)
55
- REVISION_STRING = '$Revision: 1263 $'
56
- REVISION_STRING.scan(/Revision: (\d*)/)
57
- REVISION = $1 or 'unknown'
58
-
59
- # The Release number
60
- VERSION_SHORT = '1.5.6'
61
- VERSION = VERSION_SHORT + '.' + REVISION
62
-
63
54
  # Used internally to determine when IE has finished loading a page
64
55
  READYSTATE_COMPLETE = 4
65
56
 
@@ -75,9 +66,6 @@ module Watir
75
66
  # the last command
76
67
  attr_reader :down_load_time
77
68
 
78
- # Whether the speed is :fast or :slow
79
- attr_reader :speed
80
-
81
69
  # the OLE Internet Explorer object
82
70
  attr_accessor :ie
83
71
 
@@ -194,19 +182,25 @@ module Watir
194
182
  @url_list = []
195
183
  end
196
184
 
185
+ # Specifies the speed that commands will be executed at. Choices are:
186
+ # * :slow (default)
187
+ # * :fast
188
+ # * :zippy
189
+ # With IE#speed= :zippy, text fields will be entered at once, instead of
190
+ # character by character (default).
197
191
  def speed= how_fast
198
192
  case how_fast
199
- when :zippy :
193
+ when :zippy then
200
194
  @typingspeed = 0
201
195
  @pause_after_wait = 0.01
202
196
  @type_keys = false
203
197
  @speed = :fast
204
- when :fast :
198
+ when :fast then
205
199
  @typingspeed = 0
206
200
  @pause_after_wait = 0.01
207
201
  @type_keys = true
208
202
  @speed = :fast
209
- when :slow :
203
+ when :slow then
210
204
  @typingspeed = 0.08
211
205
  @pause_after_wait = 0.1
212
206
  @type_keys = true
@@ -216,6 +210,11 @@ module Watir
216
210
  end
217
211
  end
218
212
 
213
+ def speed
214
+ return @speed if @speed == :slow
215
+ return @type_keys ? :fast : :zippy
216
+ end
217
+
219
218
  # deprecated: use speed = :fast instead
220
219
  def set_fast_speed
221
220
  self.speed = :fast
@@ -389,6 +388,7 @@ module Watir
389
388
 
390
389
  # Closes the Browser
391
390
  def close
391
+ return unless exists?
392
392
  @closing = true
393
393
  @ie.quit
394
394
  end
@@ -496,7 +496,7 @@ module Watir
496
496
  doc.frames.length.times do |n|
497
497
  begin
498
498
  documents_to_wait_for << doc.frames[n.to_s].document
499
- rescue WIN32OLERuntimeError
499
+ rescue WIN32OLERuntimeError, NoMethodError
500
500
  end
501
501
  end
502
502
  rescue WIN32OLERuntimeError
File without changes
@@ -2,7 +2,7 @@
2
2
  license
3
3
  ---------------------------------------------------------------------------
4
4
  Copyright (c) 2004 - 2005, Paul Rogers and Bret Pettichord
5
- Copyright (c) 2006 - 2007, Bret Pettichord
5
+ Copyright (c) 2006 - 2008, Bret Pettichord
6
6
  All rights reserved.
7
7
 
8
8
  Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,6 @@
35
35
  (based on BSD Open Source License)
36
36
  =end
37
37
 
38
-
39
38
  require 'watir/win32ole'
40
39
 
41
40
  require 'logger'
@@ -43,37 +42,23 @@ require 'watir/winClicker'
43
42
  require 'watir/exceptions'
44
43
  require 'watir/utils'
45
44
  require 'watir/close_all'
46
- require 'watir/waiter'
47
45
  require 'watir/ie-process'
48
46
 
49
47
  require 'dl/import'
50
48
  require 'dl/struct'
51
49
  require 'Win32API'
52
50
 
53
- class String
54
- def matches(x)
55
- return self == x
56
- end
57
- end
58
-
59
- class Regexp
60
- def matches(x)
61
- return self.match(x)
62
- end
63
- end
64
-
65
- class Integer
66
- def matches(x)
67
- return self == x
68
- end
69
- end
51
+ require 'watir/matches'
70
52
 
71
- # ARGV needs to be deleted to enable the Test::Unit functionality that grabs
53
+ # these switches need to be deleted from ARGV to enable the Test::Unit
54
+ # functionality that grabs
72
55
  # the remaining ARGV as a filter on what tests to run.
73
56
  # Note: this means that watir must be require'd BEFORE test/unit.
57
+ # (Alternatively, you could require test/unit first and then put the Watir::IE
58
+ # arguments after the '--'.)
74
59
 
75
60
  # Make Internet Explorer invisible. -b stands for background
76
- $HIDE_IE = ARGV.delete('-b')
61
+ $HIDE_IE ||= ARGV.delete('-b')
77
62
 
78
63
  # Run fast
79
64
  $FAST_SPEED = ARGV.delete('-f')
@@ -86,7 +71,8 @@ require 'watir/win32'
86
71
  require 'watir/container'
87
72
  require 'watir/locator'
88
73
  require 'watir/page-container'
89
- require 'watir/ie'
74
+ require 'watir/ie-class'
75
+ require 'watir/version'
90
76
  require 'watir/popup'
91
77
  require 'watir/element'
92
78
  require 'watir/frame'
@@ -100,16 +86,14 @@ require 'watir/image'
100
86
  require 'watir/link'
101
87
  require 'watir/collections'
102
88
 
89
+ require 'watir'
90
+
103
91
  module Watir
104
92
  include Watir::Exception
105
93
 
106
94
  # Directory containing the watir.rb file
107
95
  @@dir = File.expand_path(File.dirname(__FILE__))
108
96
 
109
- def wait_until(*args)
110
- Waiter.wait_until(*args) {yield}
111
- end
112
-
113
97
  ATTACHER = Waiter.new
114
98
  # Like regular Ruby "until", except that a TimeOutException is raised
115
99
  # if the timeout is exceeded. Timeout is IE.attach_timeout.