watir 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. data/readme.rb +211 -0
  2. data/unittests/WindowLogonExample.rb +30 -0
  3. data/unittests/WindowLogonExtra.rb +7 -0
  4. data/unittests/all_tests.rb +10 -0
  5. data/unittests/all_tests_concurrent.rb +57 -0
  6. data/unittests/attachToExistingWindow_test.rb +40 -0
  7. data/unittests/buttons_test.rb +131 -0
  8. data/unittests/checkbox_test.rb +149 -0
  9. data/unittests/core_tests.rb +9 -0
  10. data/unittests/css_test.rb +60 -0
  11. data/unittests/div_test.rb +179 -0
  12. data/unittests/errorchecker_test.rb +29 -0
  13. data/unittests/filefield_test.rb +35 -0
  14. data/unittests/form_test.rb +279 -0
  15. data/unittests/frame_test.rb +141 -0
  16. data/unittests/html/blankpage.html +12 -0
  17. data/unittests/html/buttons1.html +40 -0
  18. data/unittests/html/checkboxes1.html +69 -0
  19. data/unittests/html/complex_table.html +36 -0
  20. data/unittests/html/cssTest.html +42 -0
  21. data/unittests/html/div.html +105 -0
  22. data/unittests/html/fileupload.html +45 -0
  23. data/unittests/html/formTest1.html +39 -0
  24. data/unittests/html/forms2.html +45 -0
  25. data/unittests/html/forms3.html +132 -0
  26. data/unittests/html/forms4.html +27 -0
  27. data/unittests/html/frame_buttons.html +4 -0
  28. data/unittests/html/frame_links.html +4 -0
  29. data/unittests/html/frame_multi.html +5 -0
  30. data/unittests/html/iframeTest.html +13 -0
  31. data/unittests/html/iframeTest1.html +7 -0
  32. data/unittests/html/iframeTest2.html +6 -0
  33. data/unittests/html/images/1.gif +0 -0
  34. data/unittests/html/images/2.GIF +0 -0
  35. data/unittests/html/images/3.GIF +0 -0
  36. data/unittests/html/images/button.jpg +0 -0
  37. data/unittests/html/images/circle.jpg +0 -0
  38. data/unittests/html/images/minus.GIF +0 -0
  39. data/unittests/html/images/originaltriangle.jpg +0 -0
  40. data/unittests/html/images/plus.gif +0 -0
  41. data/unittests/html/images/square.jpg +0 -0
  42. data/unittests/html/images/triangle.jpg +0 -0
  43. data/unittests/html/images1.html +52 -0
  44. data/unittests/html/javascriptevents.html +39 -0
  45. data/unittests/html/link_pass.html +11 -0
  46. data/unittests/html/links1.html +37 -0
  47. data/unittests/html/links2.html +11 -0
  48. data/unittests/html/nestedFrames.html +6 -0
  49. data/unittests/html/pass.html +10 -0
  50. data/unittests/html/popups1.html +60 -0
  51. data/unittests/html/radioButtons1.html +71 -0
  52. data/unittests/html/select_tealeaf.html +54 -0
  53. data/unittests/html/selectboxes1.html +55 -0
  54. data/unittests/html/simple_table.html +26 -0
  55. data/unittests/html/simple_table_buttons.html +104 -0
  56. data/unittests/html/simple_table_columns.html +76 -0
  57. data/unittests/html/table1.html +142 -0
  58. data/unittests/html/textarea.html +30 -0
  59. data/unittests/html/textfields1.html +87 -0
  60. data/unittests/html/textsearch.html +44 -0
  61. data/unittests/ie_mock.rb +93 -0
  62. data/unittests/ie_test.rb +50 -0
  63. data/unittests/images_test.rb +179 -0
  64. data/unittests/iostring.rb +30 -0
  65. data/unittests/iostring_test.rb +48 -0
  66. data/unittests/js_events_test.rb +77 -0
  67. data/unittests/jscriptExtraAlert.rb +6 -0
  68. data/unittests/jscriptExtraConfirmCancel.rb +7 -0
  69. data/unittests/jscriptExtraConfirmOk.rb +7 -0
  70. data/unittests/jscriptPushButton.rb +5 -0
  71. data/unittests/jscript_test.rb +57 -0
  72. data/unittests/links_test.rb +169 -0
  73. data/unittests/minmax_test.rb +31 -0
  74. data/unittests/navigate_test.rb +56 -0
  75. data/unittests/non_core_tests.rb +9 -0
  76. data/unittests/pagecontainstext_test.rb +49 -0
  77. data/unittests/popups_test.rb +44 -0
  78. data/unittests/radios_test.rb +164 -0
  79. data/unittests/screen_capture_test.rb +53 -0
  80. data/unittests/selectbox_test.rb +197 -0
  81. data/unittests/send_keys_test.rb +29 -0
  82. data/unittests/setup.rb +47 -0
  83. data/unittests/table_test.rb +306 -0
  84. data/unittests/textAreafields_test.rb +81 -0
  85. data/unittests/textfields_test.rb +239 -0
  86. data/watir.rb +3744 -0
  87. data/watir/AutoItX3.dll +0 -0
  88. data/watir/WindowHelper.rb +47 -0
  89. data/watir/camel_case.rb +37 -0
  90. data/watir/clickJSDialog.rb +19 -0
  91. data/watir/cookiemanager.rb +53 -0
  92. data/watir/exceptions.rb +60 -0
  93. data/watir/screen_capture.rb +115 -0
  94. data/watir/setFileDialog.rb +16 -0
  95. data/watir/testUnitAddons.rb +47 -0
  96. data/watir/watir_simple.rb +475 -0
  97. data/watir/winClicker.rb +505 -0
  98. metadata +152 -0
@@ -0,0 +1,211 @@
1
+ =begin rdoc
2
+
3
+ This is Watir - Web Application Testing In Ruby http://wtr.rubyforge.org
4
+
5
+ To Install:
6
+ Execute install.rb.
7
+
8
+ How To Use:
9
+ This only works on Windows. It has been tested on Windows 2000 and XP.
10
+ Best is to use Ruby 1.8.2-14 or later.
11
+ This has been developed and tested using Ruby 1.8.1-11, Ruby 1.8.1-12.
12
+ It will NOT work with Ruby 1.8.1-13. (This version of Ruby has a bad WIN32OLE library.)
13
+ Requires Internet Explorer 5.5 or newer.
14
+ Check out the mail lists and the documentation for the workarounds.
15
+ Install ruby from http://ruby-lang.org
16
+
17
+ Unit Tests:
18
+ Run the unittests in a cmd shell. Go to the dir where you installed it and then type 'ruby unittests/core_tests.rb'.
19
+ See the user guide if you are having problems with security blocking.
20
+
21
+ Changes in 1.4.1
22
+ (based on watir.rb revision 1.215)
23
+ removed annoying warning message that sometimes appeared
24
+ corrected Element#class_name references which has been misnamed Element#style
25
+ removed IE#capture_events (didn't really work)
26
+ added IE#bring_to_front and IE#front?
27
+ fixed failing frame tests
28
+ remove failing test for disabled images
29
+ better rdoc
30
+
31
+ Changes in 1.4.0
32
+ fix method name for accessing class name of P/Span/Div (change from style to class_name)
33
+ fix for bug 2152 (frame index in show_frames off by 1)
34
+ added alt as a property to image
35
+ added file_fields
36
+ fixed TextArea#to_s
37
+ moved reset button to buttons class
38
+ add IE#send_keys
39
+ frames can now be referenced using regexps and ids
40
+ added IE#minimize, IE#maximize, IE#restore
41
+ onChange and onBlur events now triggered by TextField#set
42
+ added default option to set for checkbox
43
+ added colspan method to tablecell
44
+ fix for bug reported by Scott P, wrong objects are sometimes found
45
+ fixed bug with radio/checkboxes doing multiple fireevents
46
+ fix for table, id and reg exp
47
+ wait for page load before returning from IE.attach
48
+ update to select_list -- new interface still in progress
49
+ added .show method to iterators
50
+ fix for flashing objects in table cells
51
+ added flash for forms
52
+ flash returns nil instead of the curious '10'
53
+ removed ScreenCapture module from IE class
54
+
55
+ Changes in 1.3.1
56
+ Added P tag support
57
+ Bug fix for images and links in frames using each
58
+ Bug fixes for image#save
59
+
60
+ Changes in 1.3
61
+ added new row_values and column_value methods to tables
62
+ added ability to save an image - ie.image(:index,1).save('c:\temp\mypic.gif')
63
+ new method, html that applies to objects, not just a page - ie.button(:index,1).html => <INPUT id=b2 title="this is button1" onclick="javascript:document.location='pass.html';" type=button value="Click Me" name=b1>
64
+ now throws a NavigationException on 404, 500 errors
65
+ iterators now mixin Enumerable
66
+ added support for labels
67
+ added support for frames by index
68
+ added screen_capture
69
+ added hidden field support, and iterator method
70
+ table cells, span and div now act as containers, so can do ie.div(:index,1).button(:index.2).click
71
+ added index to print out from show_xx methods. Link shows img src if an image is used
72
+ added onKeyUp and onKeyDown to text_fields#set
73
+ installer now installs AutoIt to deal with javascript popups, file uploads etc
74
+ the spinner is now off by default
75
+ bug fix in text_fields iterator where it wasnt iterating through password or text ares. Added test for password fields
76
+ bug fix for flash for tables
77
+ bug fixes for images and links in cells
78
+
79
+ Typical Usage
80
+ # include the controller
81
+ require 'watir'
82
+ # create an instance of the controller
83
+ ie = Watir::IE.new
84
+ # go to the page you want to test
85
+ ie.goto("http://myserver/mypage")
86
+ # to enter text into a text field - assuming the field is name "username"
87
+ ie.text_field(:name, "username").set("Paul")
88
+ # if there was a text field that had an id of "company_ID", you could set it to Ruby Co:
89
+ ie.text_field(:id ,"company_ID").set("Ruby Co")
90
+ # to click a button that has a caption of 'Cancel'
91
+ ie.button(:value, "Cancel").click
92
+
93
+ The ways that are available to identify an html object depend upon the object type, but include
94
+ :id used for an object that has an ID attribute -- this is the best way!
95
+ :name used for an object that has a name attribute.
96
+ :value value of text fields, captions of buttons
97
+ :index finds the nth object of the specified type - eg button(:index , 2) finds the second button. This is 1 based. <br>
98
+ :beforeText finds the object immeditaley before the specified text. Doesnt work if the text is in a table cell
99
+ :afterText finds the object immeditaley after the specified text. Doesnt work if the text is in a table cell
100
+
101
+ The objects that are currently supported include
102
+ Button
103
+ Radio
104
+ CheckBox
105
+ TextField (Including TextArea and Password)
106
+ Hidden
107
+ SelectList
108
+ Label
109
+ Span
110
+ Div
111
+ P
112
+ Link
113
+ Table
114
+ Image
115
+
116
+ These 2 web sites provide info on Internet Explorer and on the DOM as implemented by Internet Explorer
117
+ http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/webbrowser.asp
118
+ http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/overview/overview.asp
119
+
120
+ Command line options:
121
+
122
+ -b (background) Run Internet Explorer invisible
123
+ -f (fast) Run tests very fast
124
+ -x (spinner) Add a spinner that displays when pages are waiting to be loaded.
125
+
126
+ Note that if you also use test/unit, you will need to require 'watir' first to avoid conflicts
127
+ with its command line switches.
128
+
129
+ Javascript Pop Up Support
130
+ Watir now installs AutoIt - http://www.autoitscript.com/
131
+ This is the preffered method for dealing with pop ups, file requesters etc. Support for Winclickers will be removed.
132
+
133
+ Contacts:
134
+ Paul Rogers (paul.rogers@shaw.ca)
135
+ Bret Pettichord (bret@pettichord.com)
136
+ The mailing list: http://rubyforge.org/mail/?group_id=104
137
+
138
+ Contributors:
139
+ Bret Pettichord
140
+ Paul Rogers
141
+ Jonathan Kohl
142
+ Chris Morris
143
+ Karlin Fox
144
+ Lorenzo Jorquera
145
+ Atilla Ozgur
146
+ Justin McCarthy
147
+ Chris McMahon
148
+ Elisabeth Hendrickson
149
+ Michael Kelly (Indianapolis)
150
+ Peter Chau
151
+ Jacinda Scott
152
+ Danny Faught
153
+ Andy Sipe
154
+ John Lloyd-Jones
155
+ Chris Hedges
156
+ Park Heesob
157
+ Shashank Date
158
+ Jared Luxenberg
159
+ Alexey Verkhovsky
160
+ Tuyet Cong-Ton-Nu
161
+ Kingsley Hendrickse
162
+
163
+ Acknowledgements:
164
+ Chris Morris
165
+ Brian Marick
166
+ Jonathan Kohl
167
+ Penny Tonita
168
+ Janet Gregory
169
+ Andy Tinkham
170
+
171
+ Thanks for your ideas and support!
172
+
173
+ License
174
+ ---------------------------------------------------------------------------
175
+ Copyright (c) 2004-2005, Paul Rogers and Bret Pettichord
176
+ All rights reserved.
177
+
178
+ Redistribution and use in source and binary forms, with or without
179
+ modification, are permitted provided that the following conditions are met:
180
+
181
+ 1. Redistributions of source code must retain the above copyright notice,
182
+ this list of conditions and the following disclaimer.
183
+
184
+ 2. Redistributions in binary form must reproduce the above copyright
185
+ notice, this list of conditions and the following disclaimer in the
186
+ documentation and/or other materials provided with the distribution.
187
+
188
+ 3. Neither the names Paul Rogers, Bret Pettichord nor the names of contributors to
189
+ this software may be used to endorse or promote products derived from this
190
+ software without specific prior written permission.
191
+
192
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
193
+ IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
194
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
195
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
196
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
197
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
198
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
199
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
200
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
201
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
202
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
203
+ --------------------------------------------------------------------------
204
+ (based on BSD Open Source License)
205
+
206
+
207
+
208
+
209
+ =end
210
+ class ReadMe
211
+ end
@@ -0,0 +1,30 @@
1
+
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
4
+ require 'unittests/setup'
5
+ require 'watir/WindowHelper'
6
+
7
+ class TC_Logon_Test < Test::Unit::TestCase
8
+ include Watir
9
+
10
+ def goto_windows_login_page()
11
+ $ie.goto('http://clio.lyris.com/')
12
+ end
13
+
14
+
15
+ def test_window_logon()
16
+
17
+ a = Thread.new {
18
+ system('ruby WindowLogonExtra.rb')
19
+
20
+ }
21
+ b = Thread.new {
22
+ goto_windows_login_page()
23
+ }
24
+ a.join
25
+ b.join
26
+ end
27
+
28
+
29
+
30
+ end
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
2
+
3
+ require 'watir/WindowHelper'
4
+
5
+
6
+ helper = WindowHelper.new
7
+ helper.logon('Connect to clio.lyris.com')
@@ -0,0 +1,10 @@
1
+ TOPDIR = File.join(File.dirname(__FILE__), '..')
2
+ $LOAD_PATH.unshift TOPDIR
3
+
4
+ require 'unittests/setup.rb'
5
+
6
+ Dir.chdir TOPDIR
7
+ $all_tests.each {|x| require x}
8
+
9
+
10
+
@@ -0,0 +1,57 @@
1
+ # This is an UNFINISHED attempt to run the unit tests currently.
2
+ # The work on the harness is complete.
3
+ # The problem remaining is that the tests are not thread-safe.
4
+ # It's an open question whether getting this to work would actually save any execution time.
5
+
6
+ TOPDIR = File.join(File.dirname(__FILE__), '..')
7
+ $LOAD_PATH.unshift TOPDIR
8
+ Dir.chdir TOPDIR
9
+ #(Dir["unittests/*_test.rb"] - ["unittests/popups_test.rb"]).each {|x| require x}
10
+
11
+ require 'unittests/buttons_test'
12
+ require 'unittests/checkbox_test'
13
+
14
+ require 'test/unit/testsuite'
15
+ require 'thread'
16
+ class ConcurrentTestSuite < Test::Unit::TestSuite
17
+
18
+ # Runs the tests and/or suites contained in this TestSuite.
19
+ def run(result, &progress_block)
20
+ yield(STARTED, name)
21
+ threads = []
22
+ @tests.each do |test|
23
+ threads << Thread.new do
24
+ test.run(result, &progress_block)
25
+ end
26
+ end
27
+ threads.each {|t| t.join}
28
+ yield(FINISHED, name)
29
+ end
30
+ end
31
+
32
+ # create a suite
33
+ require 'test/unit/collector/objectspace'
34
+
35
+ require 'test/unit/collector'
36
+ include Test::Unit::Collector
37
+
38
+
39
+ @filters = []
40
+ suite = ConcurrentTestSuite.new('super suite')
41
+ sub_suites = []
42
+ ::ObjectSpace.each_object(Class) do |klass|
43
+ if(Test::Unit::TestCase > klass)
44
+ puts sub_suites, klass.suite
45
+ add_suite(sub_suites, klass.suite)
46
+ end
47
+ end
48
+ sort(sub_suites).each{|s| suite << s}
49
+
50
+
51
+
52
+ # select a runner
53
+ require 'test/unit/ui/console/testrunner'
54
+ Test::Unit::UI::Console::TestRunner.run(suite)
55
+
56
+
57
+ # then subclass Test::Unit::TestSuite and override the run method to be multithreaded
@@ -0,0 +1,40 @@
1
+ # feature tests for attaching to existing IE windows
2
+ # revision: $Revision: 1.8 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_ExistingWindow< Test::Unit::TestCase
8
+ include Watir
9
+
10
+ def goto_page(page)
11
+ $ie.goto($htmlRoot + page)
12
+ end
13
+
14
+ def test_ExistingWindow
15
+ goto_page 'buttons1.html'
16
+ ie3=nil
17
+
18
+ assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:title , "missing") }
19
+ assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:title , /missing/) }
20
+
21
+ assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:url , "missing") }
22
+ assert_raises( NoMatchingWindowFoundException ) { ie3 = IE.attach(:url , /missing/) }
23
+
24
+ ie3 = IE.attach(:title , /buttons/i )
25
+ assert_equal( "Test page for buttons" , ie3.title)
26
+ ie3=nil
27
+
28
+ ie3 = IE.attach(:title , "Test page for buttons" )
29
+ assert_equal( "Test page for buttons" , ie3.title)
30
+ ie3=nil
31
+
32
+ ie3 = IE.attach(:url, /buttons1.html/ )
33
+ assert_equal( "Test page for buttons" , ie3.title)
34
+ ie3=nil
35
+
36
+ #hard to test :url with explicit text
37
+ end
38
+
39
+ end
40
+
@@ -0,0 +1,131 @@
1
+ # feature tests for Buttons
2
+ # revision: $Revision: 1.32 $
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
5
+ require 'unittests/setup'
6
+
7
+ class TC_Buttons < Test::Unit::TestCase
8
+ include Watir
9
+
10
+ def setup
11
+ $ie.goto($htmlRoot + "buttons1.html")
12
+ end
13
+
14
+ def goto_frames_page()
15
+ $ie.goto($htmlRoot + "frame_buttons.html")
16
+ end
17
+
18
+ def aatest_Spinner
19
+ s = Spinner.new
20
+ i = 0
21
+ while(i < 100)
22
+ sleep 0.05
23
+ print s.next
24
+ i+=1
25
+ end
26
+ s = nil
27
+ end
28
+
29
+ def aaatest_Button_to_s
30
+ # i think the tests for to_s should be dropped. The output is not in a nice format to be tested, and the
31
+ # individual properties are tested in the test_properties method
32
+
33
+ b4 = ['name b4',
34
+ 'type button',
35
+ 'id b5',
36
+ 'value Disabled Button',
37
+ 'disabled true']
38
+ b1 = ['name b1',
39
+ 'type button',
40
+ 'id b2',
41
+ 'value Click Me',
42
+ 'disabled false']
43
+
44
+ assert_equal(b4, $ie.button(:name, "b4").to_s)
45
+ assert_equal(b1, $ie.button(:caption, "Click Me").to_s)
46
+ assert_equal(b1, $ie.button(:index, 1).to_s)
47
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").to_s }
48
+ end
49
+
50
+ def test_properties
51
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").id }
52
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").name }
53
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").disabled }
54
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").type }
55
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").value }
56
+
57
+ assert_equal("b1" , $ie.button(:index, 1).name )
58
+ assert_equal("b2" , $ie.button(:index, 1).id )
59
+ assert_equal("button" , $ie.button(:index, 1).type )
60
+ assert_equal("Click Me" , $ie.button(:index, 1).value )
61
+ assert_equal(false , $ie.button(:index, 1).disabled )
62
+
63
+ assert_equal("b1" , $ie.button(:id, "b2").name )
64
+ assert_equal("b2" , $ie.button(:id, "b2").id )
65
+ assert_equal("button" , $ie.button(:id, "b2").type )
66
+
67
+ assert_equal("b4" , $ie.button(:index, 2).name )
68
+ assert_equal("b5" , $ie.button(:index, 2).id )
69
+ assert_equal("button" , $ie.button(:index, 2).type )
70
+ assert_equal("Disabled Button" , $ie.button(:index, 2).value )
71
+ assert_equal(true , $ie.button(:index, 2).disabled )
72
+
73
+ assert_equal( "" , $ie.button(:index, 2).title )
74
+ assert_equal( "this is button1" , $ie.button(:index, 1).title )
75
+ end
76
+
77
+
78
+ def test_button_using_default
79
+ # since most of the time, a button will be accessed based on its caption, there is a default way of accessing it....
80
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button( "Missing Caption").click }
81
+
82
+ $ie.button("Click Me").click
83
+ assert($ie.contains_text("PASS") )
84
+ end
85
+
86
+ def test_Button_click_only
87
+ $ie.button(:caption, "Click Me").click
88
+ assert($ie.contains_text("PASS") )
89
+ end
90
+
91
+ def test_button_click
92
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:caption, "Missing Caption").click }
93
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:id, "missingID").click }
94
+
95
+ assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ie.button(:caption, "Disabled Button").click }
96
+
97
+ $ie.button(:caption, "Click Me").click
98
+ assert($ie.contains_text("PASS") )
99
+ end
100
+
101
+ def test_Button_Exists
102
+ assert($ie.button(:caption, "Click Me").exists?)
103
+ assert($ie.button(:caption, "Submit").exists?)
104
+ assert($ie.button(:name, "b1").exists?)
105
+ assert($ie.button(:id, "b2").exists?)
106
+ assert($ie.button(:caption, /sub/i).exists?)
107
+
108
+ assert_false($ie.button(:caption, "missingcaption").exists?)
109
+ assert_false($ie.button(:name, "missingname").exists?)
110
+ assert_false($ie.button(:id, "missingid").exists?)
111
+ assert_false($ie.button(:caption, /missing/i).exists?)
112
+ end
113
+
114
+ def test_Button_Enabled
115
+ assert($ie.button(:caption, "Click Me").enabled?)
116
+ assert_false($ie.button(:caption, "Disabled Button").enabled?)
117
+ assert_false($ie.button(:name, "b4").enabled?)
118
+ assert_false($ie.button(:id, "b5").enabled?)
119
+
120
+ assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").enabled? }
121
+ end
122
+
123
+ def test_frame
124
+ goto_frames_page()
125
+
126
+ assert($ie.frame("buttonFrame").button(:caption, "Click Me").enabled?)
127
+ assert_raises( UnknownObjectException , "UnknownObjectException was supposed to be thrown ( no frame name supplied) " ) { $ie.button(:caption, "Disabled Button").enabled?}
128
+ end
129
+
130
+ end
131
+