watir 1.4.1 → 1.5.2
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.
- data/bin/watir-console +1 -0
- data/changes.rb +119 -0
- data/license.rb +37 -0
- data/readme.rb +55 -120
- data/unittests/buttons_test.rb +107 -104
- data/unittests/buttons_xpath_test.rb +69 -0
- data/unittests/checkbox_test.rb +154 -141
- data/unittests/checkbox_xpath_test.rb +107 -0
- data/unittests/core_tests.rb +6 -2
- data/unittests/css_test.rb +50 -50
- data/unittests/defer_test.rb +47 -0
- data/unittests/dialog_test.rb +78 -0
- data/unittests/div2_xpath_test.rb +22 -0
- data/unittests/div_test.rb +159 -159
- data/unittests/div_xpath_test.rb +96 -0
- data/unittests/errorchecker_test.rb +22 -22
- data/unittests/filefield_test.rb +30 -23
- data/unittests/filefield_xpath_test.rb +35 -0
- data/unittests/form_test.rb +250 -229
- data/unittests/form_xpath_test.rb +253 -0
- data/unittests/frame_test.rb +123 -108
- data/unittests/google_form_test.rb +17 -0
- data/unittests/html/JavascriptClick.html +39 -0
- data/unittests/html/buttons1.html +3 -2
- data/unittests/html/checkboxes1.html +32 -14
- data/unittests/html/complex_table.html +1 -1
- data/unittests/html/depot_store.html +59 -0
- data/unittests/html/div.html +3 -21
- data/unittests/html/div_xml.html +21 -0
- data/unittests/html/fileupload.html +2 -2
- data/unittests/html/forms2.html +3 -3
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/frame_links.html +2 -2
- data/unittests/html/google_india.html +119 -0
- data/unittests/html/iframeTest.html +2 -2
- data/unittests/html/images/map.GIF +0 -0
- data/unittests/html/images/map2.gif +0 -0
- data/unittests/html/images1.html +17 -2
- data/unittests/html/javascriptevents.html +3 -7
- data/unittests/html/links1.html +9 -8
- data/unittests/html/links_multi.html +14 -0
- data/unittests/html/list_matters.html +720 -0
- data/unittests/html/lists.html +18 -0
- data/unittests/html/map_test.html +31 -0
- data/unittests/html/modal_dialog.html +10 -0
- data/unittests/html/modal_dialog_launcher.html +12 -0
- data/unittests/html/new_browser.html +17 -0
- data/unittests/html/pass.html +3 -0
- data/unittests/html/popups1.html +1 -1
- data/unittests/html/pre.html +28 -0
- data/unittests/html/radioButtons1.html +6 -5
- data/unittests/html/selectboxes1.html +12 -11
- data/unittests/html/simple_table.html +1 -1
- data/unittests/html/simple_table_columns.html +1 -1
- data/unittests/html/table1.html +1 -1
- data/unittests/html/tableCell_using_xpath.html +19 -0
- data/unittests/html/textfields1.html +6 -4
- data/unittests/html/xpath_nbsp.html +12 -0
- data/unittests/ie_exists_test.rb +32 -0
- data/unittests/ie_mock.rb +78 -79
- data/unittests/ie_test.rb +39 -39
- data/unittests/images_test.rb +132 -155
- data/unittests/images_xpath_test.rb +91 -0
- data/unittests/links_multi_test.rb +36 -0
- data/unittests/links_test.rb +158 -152
- data/unittests/links_xpath_test.rb +40 -0
- data/unittests/lists_test.rb +29 -0
- data/unittests/map_test.rb +99 -0
- data/unittests/minmax_test.rb +23 -23
- data/unittests/navigate_test.rb +43 -51
- data/unittests/nbsp_xpath_test.rb +18 -0
- data/unittests/other/WindowLogonExample.rb +28 -0
- data/unittests/{WindowLogonExtra.rb → other/WindowLogonExtra.rb} +0 -0
- data/unittests/{all_tests_concurrent.rb → other/all_tests_concurrent.rb} +23 -23
- data/unittests/other/navigate_exception_test.rb +14 -0
- data/unittests/other/rexml_unit_test.rb +24 -0
- data/unittests/other/testcase_method_order_test.rb +36 -0
- data/unittests/other/testcase_verify_test.rb +25 -0
- data/unittests/other/wait_until_test.rb +99 -0
- data/unittests/pagecontainstext_test.rb +56 -37
- data/unittests/parent_child_test.rb +55 -0
- data/unittests/popups_test.rb +37 -37
- data/unittests/pre_test.rb +52 -0
- data/unittests/radios_test.rb +186 -155
- data/unittests/radios_xpath_test.rb +101 -0
- data/unittests/screen_capture_test.rb +41 -41
- data/unittests/selectbox_test.rb +223 -181
- data/unittests/selectbox_xpath_test.rb +113 -0
- data/unittests/setup.rb +29 -25
- data/unittests/speed_settings_test.rb +22 -0
- data/unittests/table_cell_using_xpath_test.rb +40 -0
- data/unittests/table_test.rb +315 -284
- data/unittests/table_xpath_test.rb +114 -0
- data/unittests/textarea_test.rb +81 -0
- data/unittests/textarea_xpath_test.rb +82 -0
- data/unittests/textfields_test.rb +205 -229
- data/unittests/textfields_xpath_test.rb +111 -0
- data/unittests/window_tests.rb +7 -0
- data/unittests/windows/attach_to_existing_window_test.rb +52 -0
- data/unittests/windows/attach_to_new_window_test.rb +82 -0
- data/unittests/windows/close_window_test.rb +22 -0
- data/unittests/windows/frame_links_test.rb +25 -0
- data/unittests/windows/ie-each_test.rb +48 -0
- data/unittests/windows/iedialog_test.rb +55 -0
- data/unittests/windows/js_events_test.rb +57 -0
- data/unittests/windows/jscriptExtraAlert.rb +6 -0
- data/unittests/windows/jscriptExtraConfirmCancel.rb +7 -0
- data/unittests/windows/jscriptExtraConfirmOk.rb +7 -0
- data/unittests/{jscriptPushButton.rb → windows/jscriptPushButton.rb} +1 -1
- data/unittests/windows/jscript_test.rb +64 -0
- data/unittests/windows/modal_dialog_test.rb +127 -0
- data/unittests/windows/new.rb +56 -0
- data/unittests/windows/open_close_test.rb +22 -0
- data/unittests/windows/send_keys_test.rb +34 -0
- data/unittests/xpath_tests.rb +10 -0
- data/watir.rb +4344 -3565
- data/watir/IEDialog/Release/IEDialog.dll +0 -0
- data/watir/WindowHelper.rb +13 -11
- data/watir/assertions.rb +36 -0
- data/watir/camel_case.rb +14 -5
- data/watir/close_all.rb +38 -0
- data/watir/contrib/enabled_popup.rb +21 -0
- data/watir/contrib/ie-new-process.rb +27 -0
- data/watir/contrib/page_checker.rb +29 -0
- data/watir/contrib/visible.rb +47 -0
- data/watir/cookiemanager.rb +4 -4
- data/watir/datahandler.rb +107 -0
- data/watir/dialog.rb +46 -0
- data/watir/elements.rb +65 -0
- data/watir/exceptions.rb +18 -36
- data/watir/ie-process.rb +40 -0
- data/watir/irb-history.rb +31 -0
- data/watir/process.rb +20 -0
- data/watir/testUnitAddons.rb +3 -42
- data/watir/testcase.rb +58 -0
- data/watir/utils.rb +20 -0
- data/watir/waiter.rb +88 -0
- data/watir/watir_simple.rb +4 -4
- data/watir/win32ole.rb +8 -0
- data/watir/win32ole/win32ole.so +0 -0
- data/watir/winClicker.rb +374 -400
- metadata +209 -128
- data/unittests/WindowLogonExample.rb +0 -30
- data/unittests/attachToExistingWindow_test.rb +0 -40
- data/unittests/js_events_test.rb +0 -77
- data/unittests/jscriptExtraAlert.rb +0 -6
- data/unittests/jscriptExtraConfirmCancel.rb +0 -7
- data/unittests/jscriptExtraConfirmOk.rb +0 -7
- data/unittests/jscript_test.rb +0 -57
- data/unittests/send_keys_test.rb +0 -29
- data/unittests/textAreafields_test.rb +0 -81
data/bin/watir-console
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exec 'irb.bat -r irb/completion -r watir/irb-history -r watir --simple-prompt --readline'
|
data/changes.rb
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
Major Changes in 1.5
|
|
3
|
+
Support for IE's Modal Dialogs.
|
|
4
|
+
showModalDialog()
|
|
5
|
+
Any method can be used to specify an element (:text, :class, etc.).
|
|
6
|
+
ie.button(:class,'Button Menu').click
|
|
7
|
+
ie.div(:text, 'Type').text_field(:class, 'TextInput-input').set('my value')
|
|
8
|
+
ie.button(:text, 'Save').click
|
|
9
|
+
One can now use multiple attributes to specify an element.
|
|
10
|
+
ie.span(:class =>'Label', :text => 'Add new').click
|
|
11
|
+
|
|
12
|
+
Other Changes in 1.5
|
|
13
|
+
* Migrated IE.new_process from watir/contrib and improved its reliability. We now recommend IE.new_process over IE.new as a way to avoid numerous errors detailed in http://jira.openqa.org/browse/WTR-150.
|
|
14
|
+
* Added IE.start_process. This works like IE.start, but uses the new_process mechanism to start IE.
|
|
15
|
+
* Added IE.new_window and IE.start_window. This are synonyms for IE.new and IE.start.
|
|
16
|
+
* Added dependency on the win32-process gem.
|
|
17
|
+
* Added IE.each, which iterates through the various IE windows currently open.
|
|
18
|
+
* Updated WindowHelper and watir/dialog to work with IE7
|
|
19
|
+
* The wait method was completely rewritten. This should fix various errors seen in 1.5.1.1165 and 1.5.1.1158.
|
|
20
|
+
* Removed the "spinner".
|
|
21
|
+
* Fixed bug in Element#parent and updated unit test.
|
|
22
|
+
* HTML value attributes are checked as strings before converting, updated unit tests.
|
|
23
|
+
* Watir::wait_until clean up.
|
|
24
|
+
* Fix for winclicker when installed in directory with spaces.
|
|
25
|
+
* Rdoc changes and updates.
|
|
26
|
+
* A workaround for frame access errors in the wait command, swallowing access denied errors and rethrowing if other WIN32OLERuntimeErrors show up.
|
|
27
|
+
* Add support for "li" tag.
|
|
28
|
+
* Fix for bug in element_by_xpath. http://www.mail-archive.com/wtr-general@rubyforge.org/msg06742.html
|
|
29
|
+
* "Wait" method now is called recursively into nested frames. http://jira.openqa.org/browse/WTR-107
|
|
30
|
+
* Rdocs now only include the core Watir library (not contrib).
|
|
31
|
+
* Improve error reporting when IE#modal_dialog isn't found.
|
|
32
|
+
* Add method "ModalDialog#exists?"
|
|
33
|
+
* Add Watir::Win32.window_exists? method.
|
|
34
|
+
* Fix for winclicker setComboBoxTest and setTextBoxText http://jira.openqa.org/browse/WTR-124
|
|
35
|
+
* Improved Support for IE7
|
|
36
|
+
o Fix for IE7 on ie.exists? http://jira.openqa.org/browse/WTR-123
|
|
37
|
+
o Fix for IE7 with winclicker.
|
|
38
|
+
o Fix for check_for_http_error in IE7. http://jira.openqa.org/browse/WTR-141
|
|
39
|
+
* Fix for IE7 on ie.exists? http://jira.openqa.org/browse/WTR-123
|
|
40
|
+
* Rubyw is now used in winclicker to bypass command line windows.
|
|
41
|
+
* Autoit is registered before being used.
|
|
42
|
+
* Watir now checks for the right version of Ruby before loading our customized Win32ole library.
|
|
43
|
+
* ie.file_field has been fixed and unit test updated.
|
|
44
|
+
* rdoc generation has been fixed.
|
|
45
|
+
* page checker has been moved from the default behavior into contrib/page_checker.rb
|
|
46
|
+
* Fix for intermittent crashes occuring when using Watir with Ruby version > 1.8.2.
|
|
47
|
+
* Fix for http://jira.openqa.org/browse/WTR-86
|
|
48
|
+
This fix prevents the Watir-modified win32ole.so library (compiled against 1.8.2) from being used.
|
|
49
|
+
* Added Element#parent
|
|
50
|
+
* Add new methods Element#after? and Element#before?
|
|
51
|
+
* Added support for relative specifiers. E.g.:
|
|
52
|
+
link = $ie.link(:class => 'addtocart', :after? => @headline)
|
|
53
|
+
* Removed NAVIGATION_CHECKER from Watir.rb, added to contrib. This fixes rdoc generation and stops the frame access exception being thrown in the default installation.
|
|
54
|
+
* Open-code calls to def_creator, for easier debugging and rdoc generation of factory methods.
|
|
55
|
+
* Winclicker fix for too many callbacks defined error.
|
|
56
|
+
* Patch for rspec API changes
|
|
57
|
+
* You can now reference an iframe using IE#frame(:id, 'whatever'). Jira 109
|
|
58
|
+
* Added 'map' and 'area' element support.
|
|
59
|
+
* Moved Watir::Assertions into new file watir/assertions.rb so they can be used outside test cases.
|
|
60
|
+
* Fix and unit test for Jira 114, related to tag in HTML source.
|
|
61
|
+
* Added SelectList#include? and SelectList#selected?
|
|
62
|
+
* Added Element#visible?
|
|
63
|
+
* Fixes all reported bugs with contains_text.
|
|
64
|
+
* New Watir::TestCase#verify method (and verify_equal and verify_match).
|
|
65
|
+
* The click_no_wait method now works in frames.
|
|
66
|
+
* Released new IE.new_process method to 'watir/contrib/ie-new-process'. This starts up a new IE process for each IE window, which is really how it should be done. To close these use IE#kill. Any one getting intermittent RPC errors when opening windows may want to use this instead.
|
|
67
|
+
* Several examples have been updated.
|
|
68
|
+
* Moved enabled_popup to a new contrib directory.
|
|
69
|
+
* Added several tests.
|
|
70
|
+
|
|
71
|
+
Changes in 1.4
|
|
72
|
+
fix method name for accessing class name of P/Span/Div (change from style to class_name)
|
|
73
|
+
fix for bug 2152 (frame index in show_frames off by 1)
|
|
74
|
+
added alt as a property to image
|
|
75
|
+
added file_fields
|
|
76
|
+
fixed TextArea#to_s
|
|
77
|
+
moved reset button to buttons class
|
|
78
|
+
add IE#send_keys
|
|
79
|
+
frames can now be referenced using regexps and ids
|
|
80
|
+
added IE#minimize, IE#maximize, IE#restore
|
|
81
|
+
onChange and onBlur events now triggered by TextField#set
|
|
82
|
+
added default option to set for checkbox
|
|
83
|
+
added colspan method to tablecell
|
|
84
|
+
fix for bug reported by Scott P, wrong objects are sometimes found
|
|
85
|
+
fixed Bug with radio/checkboxes doing multiple fireevents
|
|
86
|
+
fix for table, id and reg exp
|
|
87
|
+
wait for page load before returning from IE.attach
|
|
88
|
+
update to select_list -- new interface still in progress
|
|
89
|
+
added .show method to iterators
|
|
90
|
+
fix for flashing objects in table cells
|
|
91
|
+
added flash for forms
|
|
92
|
+
flash returns nil instead of the curious '10'
|
|
93
|
+
removed ScreenCapture module from IE class
|
|
94
|
+
|
|
95
|
+
Changes in 1.3.1
|
|
96
|
+
Added P tag support
|
|
97
|
+
Bug fix for images and links in frames using each
|
|
98
|
+
Bug fixes for image#save
|
|
99
|
+
|
|
100
|
+
Changes in 1.3
|
|
101
|
+
added new row_values and column_value methods to tables
|
|
102
|
+
added ability to save an image - ie.image(:index,1).save('c:\temp\mypic.gif')
|
|
103
|
+
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>
|
|
104
|
+
now throws a NavigationException on 404, 500 errors
|
|
105
|
+
iterators now mixin Enumerable
|
|
106
|
+
added support for labels
|
|
107
|
+
added support for frames by index
|
|
108
|
+
added screen_capture
|
|
109
|
+
added hidden field support, and iterator method
|
|
110
|
+
table cells, span and div now act as containers, so can do ie.div(:index,1).button(:index.2).click
|
|
111
|
+
added index to print out from show_xx methods. Link shows img src if an image is used
|
|
112
|
+
added onKeyUp and onKeyDown to text_fields#set
|
|
113
|
+
installer now installs AutoIt to deal with javascript popups, file uploads etc
|
|
114
|
+
the spinner is now off by default
|
|
115
|
+
bug fix in text_fields iterator where it wasnt iterating through password or text ares. Added test for password fields
|
|
116
|
+
bug fix for flash for tables
|
|
117
|
+
bug fixes for images and links in cells
|
|
118
|
+
|
|
119
|
+
=end
|
data/license.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
|
|
3
|
+
License
|
|
4
|
+
---------------------------------------------------------------------------
|
|
5
|
+
Copyright (c) 2004-2007, Paul Rogers and Bret Pettichord
|
|
6
|
+
All rights reserved.
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
|
9
|
+
modification, are permitted provided that the following conditions are met:
|
|
10
|
+
|
|
11
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer.
|
|
13
|
+
|
|
14
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer in the
|
|
16
|
+
documentation and/or other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
3. Neither the names Paul Rogers, Bret Pettichord nor the names of contributors to
|
|
19
|
+
this software may be used to endorse or promote products derived from this
|
|
20
|
+
software without specific prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
|
23
|
+
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
24
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
25
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
|
26
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
27
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
28
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
29
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
30
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
31
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
32
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
--------------------------------------------------------------------------
|
|
34
|
+
(based on BSD Open Source License)
|
|
35
|
+
|
|
36
|
+
=end
|
|
37
|
+
|
data/readme.rb
CHANGED
|
@@ -2,101 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
This is Watir - Web Application Testing In Ruby http://wtr.rubyforge.org
|
|
4
4
|
|
|
5
|
-
To Install:
|
|
6
|
-
|
|
5
|
+
To Install Ruby: http://ruby-lang.org
|
|
6
|
+
Best is to use Ruby 1.8.2-14 or later.
|
|
7
|
+
However, if you are using the Watir::IE#modal_dialog method, you must use Ruby 1.8.2-14 and not a more recent version.
|
|
8
|
+
Watir (in general) will not work with Ruby 1.8.1-13. (This version of Ruby has a bad WIN32OLE library.)
|
|
9
|
+
|
|
10
|
+
To Install Watir:
|
|
11
|
+
Best way to install is to use the gem.
|
|
12
|
+
From your command line:
|
|
13
|
+
> gem install win32-process --include-dependencies
|
|
14
|
+
> gem install watir
|
|
15
|
+
This will download and install watir, win32-process and all dependencies.
|
|
7
16
|
|
|
8
17
|
How To Use:
|
|
9
|
-
This only works on Windows.
|
|
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.)
|
|
18
|
+
This only works on Windows.
|
|
13
19
|
Requires Internet Explorer 5.5 or newer.
|
|
14
20
|
Check out the mail lists and the documentation for the workarounds.
|
|
15
|
-
|
|
21
|
+
|
|
22
|
+
User Guide: http://wiki.openqa.org/display/WTR/User+Guide
|
|
16
23
|
|
|
17
24
|
Unit Tests:
|
|
18
25
|
Run the unittests in a cmd shell. Go to the dir where you installed it and then type 'ruby unittests/core_tests.rb'.
|
|
19
26
|
See the user guide if you are having problems with security blocking.
|
|
20
27
|
|
|
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
28
|
Typical Usage
|
|
80
29
|
# include the controller
|
|
81
30
|
require 'watir'
|
|
82
31
|
# create an instance of the controller
|
|
83
32
|
ie = Watir::IE.new
|
|
84
33
|
# go to the page you want to test
|
|
85
|
-
ie.goto(
|
|
86
|
-
# to enter text into a text field - assuming the field is
|
|
87
|
-
ie.text_field(:name,
|
|
88
|
-
# if there was a text field that had an id of
|
|
89
|
-
ie.text_field(:id ,
|
|
34
|
+
ie.goto('http://myserver/mypage')
|
|
35
|
+
# to enter text into a text field - assuming the field is named 'username'
|
|
36
|
+
ie.text_field(:name, 'username').set('Paul')
|
|
37
|
+
# if there was a text field that had an id of 'company_ID', you could set it to 'Ruby Co':
|
|
38
|
+
ie.text_field(:id ,'company_ID').set('Ruby Co')
|
|
90
39
|
# to click a button that has a caption of 'Cancel'
|
|
91
|
-
ie.button(:value,
|
|
40
|
+
ie.button(:value, 'Cancel').click
|
|
41
|
+
|
|
42
|
+
Identifying something using two or more identifying characteristics
|
|
43
|
+
# Html objects can also be identified via a combination of two of the above methods,
|
|
44
|
+
# for example to click a span with a class name of 'Label', and whose text is 'Add new', one could say
|
|
45
|
+
ie.span(:class =>'Label', :text => 'Add new').click
|
|
46
|
+
# Or to find one object within another (for example the first text_field within a div of class
|
|
47
|
+
# 'PasswordInput', where your password equals 'MyPassword'), one could say
|
|
48
|
+
ie.div(:class, 'PasswordInput').text_field(:index, 1).set('MyPassword')
|
|
92
49
|
|
|
93
50
|
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
|
|
95
|
-
:name used for an object that has a name attribute
|
|
96
|
-
:value value of text fields, captions of buttons
|
|
51
|
+
:id used for an object that has an ID attribute.*
|
|
52
|
+
:name used for an object that has a name attribute.*
|
|
53
|
+
:value value of text fields, captions of buttons.
|
|
97
54
|
:index finds the nth object of the specified type - eg button(:index , 2) finds the second button. This is 1 based. <br>
|
|
98
|
-
:
|
|
99
|
-
:
|
|
55
|
+
:class used for an object that has a class attribute.
|
|
56
|
+
:text used for links and other objects that contain text.
|
|
57
|
+
:xpath finds the item using xpath query
|
|
58
|
+
|
|
59
|
+
* :id and :name are the quickest of these to process, and so should be used when possible to speed up scripts.
|
|
100
60
|
|
|
101
61
|
The objects that are currently supported include
|
|
102
62
|
Button
|
|
@@ -121,18 +81,18 @@ Typical Usage
|
|
|
121
81
|
|
|
122
82
|
-b (background) Run Internet Explorer invisible
|
|
123
83
|
-f (fast) Run tests very fast
|
|
124
|
-
-x (spinner) Add a spinner that displays when pages are waiting to be loaded.
|
|
125
84
|
|
|
126
85
|
Note that if you also use test/unit, you will need to require 'watir' first to avoid conflicts
|
|
127
86
|
with its command line switches.
|
|
128
87
|
|
|
129
88
|
Javascript Pop Up Support
|
|
130
|
-
Watir now installs AutoIt - http://www.autoitscript.com/
|
|
131
|
-
This is the
|
|
89
|
+
Watir now optionally installs AutoIt - http://www.autoitscript.com/
|
|
90
|
+
This is the prefered method for dealing wth pop ups, file requesters etc. Support for Winclickers will be removed.
|
|
132
91
|
|
|
133
92
|
Contacts:
|
|
134
93
|
Paul Rogers (paul.rogers@shaw.ca)
|
|
135
94
|
Bret Pettichord (bret@pettichord.com)
|
|
95
|
+
Charley Baker (charley.baker@gmail.com)
|
|
136
96
|
The mailing list: http://rubyforge.org/mail/?group_id=104
|
|
137
97
|
|
|
138
98
|
Contributors:
|
|
@@ -146,9 +106,8 @@ Contributors:
|
|
|
146
106
|
Justin McCarthy
|
|
147
107
|
Chris McMahon
|
|
148
108
|
Elisabeth Hendrickson
|
|
149
|
-
Michael Kelly
|
|
109
|
+
Michael Kelly
|
|
150
110
|
Peter Chau
|
|
151
|
-
Jacinda Scott
|
|
152
111
|
Danny Faught
|
|
153
112
|
Andy Sipe
|
|
154
113
|
John Lloyd-Jones
|
|
@@ -158,7 +117,20 @@ Contributors:
|
|
|
158
117
|
Jared Luxenberg
|
|
159
118
|
Alexey Verkhovsky
|
|
160
119
|
Tuyet Cong-Ton-Nu
|
|
161
|
-
|
|
120
|
+
Jeff Wood
|
|
121
|
+
Angrez Singh
|
|
122
|
+
Abhishek Goliya
|
|
123
|
+
Yaxin Wang
|
|
124
|
+
Michael Bolton
|
|
125
|
+
Paul Carvalho
|
|
126
|
+
Konstantin Sobolev
|
|
127
|
+
David Schmidt
|
|
128
|
+
Dara Lillis
|
|
129
|
+
Charley Baker
|
|
130
|
+
Prema Arya
|
|
131
|
+
Xavier Noria
|
|
132
|
+
Jeff Fry
|
|
133
|
+
Zeljko Filipin
|
|
162
134
|
|
|
163
135
|
Acknowledgements:
|
|
164
136
|
Chris Morris
|
|
@@ -167,45 +139,8 @@ Acknowledgements:
|
|
|
167
139
|
Penny Tonita
|
|
168
140
|
Janet Gregory
|
|
169
141
|
Andy Tinkham
|
|
142
|
+
Jacinda Scott (logo creator)
|
|
170
143
|
|
|
171
144
|
Thanks for your ideas and support!
|
|
172
145
|
|
|
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
146
|
=end
|
|
210
|
-
class ReadMe
|
|
211
|
-
end
|
data/unittests/buttons_test.rb
CHANGED
|
@@ -1,131 +1,134 @@
|
|
|
1
1
|
# feature tests for Buttons
|
|
2
|
-
# revision: $Revision:
|
|
2
|
+
# revision: $Revision: 962 $
|
|
3
3
|
|
|
4
4
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
5
|
require 'unittests/setup'
|
|
6
6
|
|
|
7
7
|
class TC_Buttons < Test::Unit::TestCase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
s = nil
|
|
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
|
|
27
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
|
|
28
32
|
|
|
29
|
-
|
|
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',
|
|
33
|
+
b4 = ['name b4',
|
|
34
34
|
'type button',
|
|
35
35
|
'id b5',
|
|
36
36
|
'value Disabled Button',
|
|
37
37
|
'disabled true']
|
|
38
|
-
|
|
38
|
+
b1 = ['name b1',
|
|
39
39
|
'type button',
|
|
40
40
|
'id b2',
|
|
41
41
|
'value Click Me',
|
|
42
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
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
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 }
|
|
76
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
|
+
assert_equal("italic_button" , $ie.button(:name, "b1").class_name )
|
|
63
|
+
assert_equal("" , $ie.button(:name , "b4").class_name )
|
|
77
64
|
|
|
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
65
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
end
|
|
66
|
+
assert_equal("b1" , $ie.button(:id, "b2").name )
|
|
67
|
+
assert_equal("b2" , $ie.button(:id, "b2").id )
|
|
68
|
+
assert_equal("button" , $ie.button(:id, "b2").type )
|
|
90
69
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
$ie.button(:caption, "Click Me").click
|
|
98
|
-
assert($ie.contains_text("PASS") )
|
|
99
|
-
end
|
|
70
|
+
assert_equal("b4" , $ie.button(:index, 2).name )
|
|
71
|
+
assert_equal("b5" , $ie.button(:index, 2).id )
|
|
72
|
+
assert_equal("button" , $ie.button(:index, 2).type )
|
|
73
|
+
assert_equal("Disabled Button" , $ie.button(:index, 2).value )
|
|
74
|
+
assert_equal(true , $ie.button(:index, 2).disabled )
|
|
100
75
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
76
|
+
assert_equal( "" , $ie.button(:index, 2).title )
|
|
77
|
+
assert_equal( "this is button1" , $ie.button(:index, 1).title )
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_button_using_default
|
|
82
|
+
# since most of the time, a button will be accessed based on its caption, there is a default way of accessing it....
|
|
83
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button( "Missing Caption").click }
|
|
113
84
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
85
|
+
$ie.button("Click Me").click
|
|
86
|
+
assert($ie.text.include?("PASS") )
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_Button_click_only
|
|
90
|
+
$ie.button(:caption, "Click Me").click
|
|
91
|
+
assert($ie.text.include?("PASS") )
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_button_click
|
|
95
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:caption, "Missing Caption").click }
|
|
96
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:id, "missingID").click }
|
|
122
97
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
98
|
+
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ie.button(:caption, "Disabled Button").click }
|
|
99
|
+
|
|
100
|
+
$ie.button(:caption, "Click Me").click
|
|
101
|
+
assert($ie.text.include?("PASS") )
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_Button_Exists
|
|
105
|
+
assert($ie.button(:caption, "Click Me").exists?)
|
|
106
|
+
assert($ie.button(:caption, "Submit").exists?)
|
|
107
|
+
assert($ie.button(:name, "b1").exists?)
|
|
108
|
+
assert($ie.button(:id, "b2").exists?)
|
|
109
|
+
assert($ie.button(:caption, /sub/i).exists?)
|
|
110
|
+
|
|
111
|
+
assert(!$ie.button(:caption, "missingcaption").exists?)
|
|
112
|
+
assert(!$ie.button(:name, "missingname").exists?)
|
|
113
|
+
assert(!$ie.button(:id, "missingid").exists?)
|
|
114
|
+
assert(!$ie.button(:caption, /missing/i).exists?)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def test_Button_Enabled
|
|
118
|
+
assert($ie.button(:caption, "Click Me").enabled?)
|
|
119
|
+
assert(!$ie.button(:caption, "Disabled Button").enabled?)
|
|
120
|
+
assert(!$ie.button(:name, "b4").enabled?)
|
|
121
|
+
assert(!$ie.button(:id, "b5").enabled?)
|
|
122
|
+
|
|
123
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.button(:name, "noName").enabled? }
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def test_frame
|
|
127
|
+
goto_frames_page
|
|
129
128
|
|
|
129
|
+
assert($ie.frame("buttonFrame").button(:caption, "Click Me").enabled?)
|
|
130
|
+
assert_raises( UnknownObjectException , "UnknownObjectException was supposed to be thrown ( no frame name supplied) " ) { $ie.button(:caption, "Disabled Button").enabled?}
|
|
131
|
+
end
|
|
132
|
+
|
|
130
133
|
end
|
|
131
134
|
|