watir 1.6.7 → 1.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +16 -2
- data/README.rdoc +5 -5
- data/VERSION +1 -1
- data/lib/watir/AutoItX.chm +0 -0
- data/lib/watir/AutoItX3.dll +0 -0
- data/lib/watir/close_all.rb +1 -1
- data/lib/watir/container.rb +7 -0
- data/lib/watir/form.rb +2 -0
- data/lib/watir/ie-class.rb +16 -6
- data/lib/watir/image.rb +2 -0
- data/lib/watir/link.rb +2 -0
- data/lib/watir/modal_dialog.rb +3 -3
- data/lib/watir/module.rb +1 -1
- data/lib/watir/non_control_elements.rb +2 -0
- data/lib/watir/table.rb +6 -0
- data/unittests/css_selector_test.rb +57 -0
- data/watir.gemspec +1 -1
- metadata +22 -15
data/CHANGES
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
+
== Version 1.7.0 - 2010/12/20
|
2
|
+
|
3
|
+
=== IE improvements
|
4
|
+
|
5
|
+
* Fixed Watir::IE#close_all. Closes http://jira.openqa.org/browse/WTR-463 (Jarmo Pertman)
|
6
|
+
* IE#wait waits now again until browser has a state of READYSTATE_COMPLETE due to strange timing issues. Closes http://jira.openqa.org/browse/WTR-466 (Jarmo Pertman)
|
7
|
+
* Added CSS3 selectors with usage like browser.text_field(:css => "input[name='text1']") (Jonas Tingeborn)
|
8
|
+
* Updated bundled version of AutoIt to 3.3.6.1. Closes http://jira.openqa.org/browse/WTR-440 (Jarmo Pertman)
|
9
|
+
|
10
|
+
=== Firefox improvements
|
11
|
+
|
12
|
+
* Fixed Element#exists? for cases where nested elements were used for locating (Alok Menghrajani)
|
13
|
+
* Ignore uppercase tags in XHTML when searching for elements (Alok Menghrajani)
|
14
|
+
|
1
15
|
== Version 1.6.7 - 2010/10/26
|
2
16
|
|
3
17
|
=== General improvements
|
4
18
|
|
5
|
-
* added new waiting methods
|
6
|
-
* added new waiting methods
|
19
|
+
* added new waiting methods for Watir::Element: #when_present, #wait_until_present and #wait_while_present (Jari Bakken and Jarmo Pertman)
|
20
|
+
* added new waiting methods for Watir::IE and Watir::Firefox: #wait_until and #wait_while (Jari Bakken and Jarmo Pertman)
|
7
21
|
* added method #present? for Watir::Element (Jari Bakken and Jarmo Pertman)
|
8
22
|
* deprecated old waiting methods in Watir::Waiter which will be removed in some future version - use Watir::Wait instead (Jarmo Pertman)
|
9
23
|
|
data/README.rdoc
CHANGED
@@ -46,11 +46,11 @@ To install Firefox driver:
|
|
46
46
|
|
47
47
|
Some examples from http://watir.com/examples
|
48
48
|
|
49
|
-
|
49
|
+
Loading Watir gem to drive Internet Explorer on Windows
|
50
50
|
|
51
51
|
require 'watir'
|
52
52
|
|
53
|
-
|
53
|
+
Loading FireWatir gem to drive Firefox on Windows/Mac/Linux
|
54
54
|
|
55
55
|
require 'firewatir'
|
56
56
|
|
@@ -69,8 +69,8 @@ Setting a multi-line text box
|
|
69
69
|
|
70
70
|
Setting and clearing a radio button
|
71
71
|
|
72
|
-
browser.radio(:value => "
|
73
|
-
browser.radio(:value => "
|
72
|
+
browser.radio(:value => "Watir").set
|
73
|
+
browser.radio(:value => "Watir").clear
|
74
74
|
|
75
75
|
Setting and clearing check boxes
|
76
76
|
|
@@ -94,7 +94,7 @@ Clicking a button
|
|
94
94
|
|
95
95
|
Checking for text in a page
|
96
96
|
|
97
|
-
puts browser.text.include?
|
97
|
+
puts browser.text.include?("Your response has been recorded.")
|
98
98
|
|
99
99
|
Checking the title of a page
|
100
100
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0.rc1
|
Binary file
|
data/lib/watir/AutoItX3.dll
CHANGED
Binary file
|
data/lib/watir/close_all.rb
CHANGED
data/lib/watir/container.rb
CHANGED
@@ -824,6 +824,8 @@ module Watir
|
|
824
824
|
case how
|
825
825
|
when :xpath
|
826
826
|
return element_by_xpath(what)
|
827
|
+
when :css
|
828
|
+
return element_by_css(what)
|
827
829
|
when :ole_object
|
828
830
|
return what
|
829
831
|
end
|
@@ -839,6 +841,11 @@ module Watir
|
|
839
841
|
locator.locate
|
840
842
|
end
|
841
843
|
|
844
|
+
# abstract method for locating an element using a CSS selector expression
|
845
|
+
def element_by_css(selector)
|
846
|
+
raise MissingWayOfFindingObjectException, "CSS selectors not yet supported for #{self.class.name}"
|
847
|
+
end
|
848
|
+
|
842
849
|
# returns the ole object for the specified element
|
843
850
|
def locate_tagged_element(tag, how, what)
|
844
851
|
locator = TaggedElementLocator.new(self, tag)
|
data/lib/watir/form.rb
CHANGED
data/lib/watir/ie-class.rb
CHANGED
@@ -50,8 +50,7 @@ module Watir
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Used internally to determine when IE has finished loading a page
|
53
|
-
|
54
|
-
READYSTATE_COMPLETE = 4
|
53
|
+
READYSTATES = {:complete => 4}
|
55
54
|
|
56
55
|
# The default color for highlighting objects as they are accessed.
|
57
56
|
HIGHLIGHT_COLOR = 'yellow'
|
@@ -312,7 +311,6 @@ module Watir
|
|
312
311
|
|
313
312
|
# Are we attached to an open browser?
|
314
313
|
def exists?
|
315
|
-
return false if @closing
|
316
314
|
begin
|
317
315
|
@ie.name =~ /Internet Explorer/
|
318
316
|
rescue WIN32OLERuntimeError
|
@@ -396,7 +394,6 @@ module Watir
|
|
396
394
|
# Closes the Browser
|
397
395
|
def close
|
398
396
|
return unless exists?
|
399
|
-
@closing = true
|
400
397
|
@ie.stop
|
401
398
|
wait rescue nil
|
402
399
|
chwnd = @ie.hwnd.to_i
|
@@ -487,7 +484,7 @@ module Watir
|
|
487
484
|
sleep interval
|
488
485
|
end
|
489
486
|
|
490
|
-
until
|
487
|
+
until READYSTATES.has_value?(@ie.readyState)
|
491
488
|
sleep interval
|
492
489
|
end
|
493
490
|
|
@@ -503,7 +500,7 @@ module Watir
|
|
503
500
|
|
504
501
|
while doc = documents_to_wait_for.shift
|
505
502
|
begin
|
506
|
-
until
|
503
|
+
until READYSTATES.has_key?(doc.readyState.to_sym)
|
507
504
|
sleep interval
|
508
505
|
end
|
509
506
|
@url_list << doc.location.href unless @url_list.include?(doc.location.href)
|
@@ -893,6 +890,19 @@ module Watir
|
|
893
890
|
end
|
894
891
|
private :html_source
|
895
892
|
|
893
|
+
# execute css selector and return an array of (ole object) elements
|
894
|
+
def elements_by_css(selector)
|
895
|
+
xmlparser_document_object # Needed to ensure Nokogiri has been loaded
|
896
|
+
xpath = Nokogiri::CSS.xpath_for(selector)[0]
|
897
|
+
elements_by_xpath(xpath)
|
898
|
+
end
|
899
|
+
|
900
|
+
# return the first (ole object) element that matches the css selector
|
901
|
+
def element_by_css(selector)
|
902
|
+
temp = elements_by_css(selector)
|
903
|
+
return temp[0] if temp
|
904
|
+
end
|
905
|
+
|
896
906
|
# return the first element that matches the xpath
|
897
907
|
def element_by_xpath(xpath)
|
898
908
|
temp = elements_by_xpath(xpath)
|
data/lib/watir/image.rb
CHANGED
data/lib/watir/link.rb
CHANGED
data/lib/watir/modal_dialog.rb
CHANGED
@@ -17,7 +17,7 @@ module Watir
|
|
17
17
|
hwnd_modal, arr = GetWindow.call(hwnd, GW_ENABLEDPOPUP) # GW_ENABLEDPOPUP = 6
|
18
18
|
hwnd_modal > 0
|
19
19
|
end
|
20
|
-
rescue
|
20
|
+
rescue Wait::TimeoutError
|
21
21
|
return nil
|
22
22
|
end
|
23
23
|
if hwnd_modal == hwnd || hwnd_modal == 0
|
@@ -47,7 +47,7 @@ module Watir
|
|
47
47
|
@hwnd, arr = FindWindowEx.call(0, 0, nil, title)
|
48
48
|
@hwnd > 0
|
49
49
|
end
|
50
|
-
rescue
|
50
|
+
rescue Wait::TimeoutError
|
51
51
|
raise NoMatchingWindowFoundException,
|
52
52
|
"Modal Dialog with title #{what} not found. Timeout = #{Watir::IE.attach_timeout}"
|
53
53
|
end
|
@@ -67,7 +67,7 @@ module Watir
|
|
67
67
|
intUnknown = intArray.first
|
68
68
|
intUnknown > 0
|
69
69
|
end
|
70
|
-
rescue
|
70
|
+
rescue Wait::TimeoutError => e
|
71
71
|
raise NoMatchingWindowFoundException,
|
72
72
|
"Unable to attach to Modal Window #{what.inspect} after #{e.duration} seconds."
|
73
73
|
end
|
data/lib/watir/module.rb
CHANGED
@@ -4,7 +4,7 @@ module Watir
|
|
4
4
|
# Directory containing the watir.rb file
|
5
5
|
@@dir = File.expand_path(File.dirname(__FILE__))
|
6
6
|
|
7
|
-
# Like regular Ruby "until", except that a
|
7
|
+
# Like regular Ruby "until", except that a Wait::TimeoutError is raised
|
8
8
|
# if the timeout is exceeded. Timeout is IE.attach_timeout.
|
9
9
|
def self.until_with_timeout # block
|
10
10
|
Wait.until(IE.attach_timeout) { yield }
|
data/lib/watir/table.rb
CHANGED
@@ -32,6 +32,8 @@ module Watir
|
|
32
32
|
def locate
|
33
33
|
if @how == :xpath
|
34
34
|
@o = @container.element_by_xpath(@what)
|
35
|
+
elsif @how == :css
|
36
|
+
@o = @container.element_by_css(@what)
|
35
37
|
elsif @how == :ole_object
|
36
38
|
@o = @what
|
37
39
|
else
|
@@ -260,6 +262,8 @@ module Watir
|
|
260
262
|
@o = @what
|
261
263
|
elsif @how == :xpath
|
262
264
|
@o = @container.element_by_xpath(@what)
|
265
|
+
elsif @how == :css
|
266
|
+
@o = @container.element_by_css(@what)
|
263
267
|
else
|
264
268
|
@o = @container.locate_tagged_element("TR", @how, @what)
|
265
269
|
end
|
@@ -355,6 +359,8 @@ module Watir
|
|
355
359
|
def locate
|
356
360
|
if @how == :xpath
|
357
361
|
@o = @container.element_by_xpath(@what)
|
362
|
+
elsif @how == :css
|
363
|
+
@o = @container.element_by_css(@what)
|
358
364
|
elsif @how == :ole_object
|
359
365
|
@o = @what
|
360
366
|
else
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Feature tests for CSS selectors.
|
2
|
+
#
|
3
|
+
# Only shallow testing is needed since the selectors are immediately
|
4
|
+
# converted to xpath and the other xpath tests will provide coverage
|
5
|
+
# for the returned objects. This test more or less only verifies that the
|
6
|
+
# respective classes have implemented the css selector as a query option.
|
7
|
+
#
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
10
|
+
require 'unittests/setup'
|
11
|
+
|
12
|
+
# Since the CSS selectors were added to Watir::IE, these CSS selector tests
|
13
|
+
# will fail when using Firefox, until someone implements the method
|
14
|
+
# "element_by_css(selector)" for that browser that is.. so for now only run
|
15
|
+
# them for IE.
|
16
|
+
if Watir::Browser.default == 'ie'
|
17
|
+
|
18
|
+
class TC_CSS_Selector < Test::Unit::TestCase
|
19
|
+
include Watir::Exception
|
20
|
+
|
21
|
+
# Same test as TC_Divs_XPath::test_divs but using css selectors instead
|
22
|
+
def test_matching_queries
|
23
|
+
goto_page "div.html"
|
24
|
+
|
25
|
+
assert_raises(UnknownObjectException) {browser.div(:css , "div[id='div77']").click }
|
26
|
+
assert_raises(UnknownObjectException) {browser.div(:css , "div[title='div77']").click }
|
27
|
+
|
28
|
+
assert(browser.text_field(:css, "input[name='text1']").verify_contains("0") )
|
29
|
+
browser.div(:css , "div[id='div3']").click
|
30
|
+
assert(browser.text_field(:css, "input[ name = 'text1' ]").verify_contains("1") )
|
31
|
+
browser.div(:css , "div[id = div4]").click
|
32
|
+
assert(browser.text_field(:css, "input[name=text1]").verify_contains("0") )
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_form
|
36
|
+
goto_page "forms2.html"
|
37
|
+
assert_equal(browser.form(:css, "#f2").action, "pass2.html")
|
38
|
+
assert_equal(browser.button(:css, "form #b2").value, "Click Me")
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_image
|
42
|
+
goto_page "div.html"
|
43
|
+
assert_equal( "circle", browser.image(:css, "*[id ^= 'circ']").id )
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_link
|
47
|
+
goto_page "links1.html"
|
48
|
+
assert_equal( "link_name", browser.link(:css, "*[name *= ink_nam]").name )
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_table
|
52
|
+
goto_page "table1.html"
|
53
|
+
assert_equal( "Header", browser.cell(:css , ".sample th").text )
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/watir.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'watir-rdoc'
|
|
2
2
|
|
3
3
|
$__watir_source_patterns = [
|
4
4
|
'CHANGES', 'rakefile.rb', 'VERSION', "README.rdoc", 'watir.gemspec', 'watir-rdoc.rb', 'LICENSE',
|
5
|
-
'lib/watir/*.rb', 'lib/watir/AutoItX3.dll',
|
5
|
+
'lib/watir/*.rb', 'lib/watir/AutoItX3.dll', 'lib/watir/AutoItX.chm',
|
6
6
|
'unittests/*.rb', 'unittests/html/*.html', 'unittests/html/images/*.*',
|
7
7
|
'unittests/other/*.rb', 'unittests/testcase/*.rb', 'unittests/windows/*.rb',
|
8
8
|
'lib/watir/IEDialog/Release/IEDialog.dll', 'lib/watir/win32ole/win32ole.so',
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 977940582
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 6
|
9
8
|
- 7
|
10
|
-
|
9
|
+
- 0
|
10
|
+
- rc1
|
11
|
+
version: 1.7.0.rc1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Bret Pettichord
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-12-21 00:00:00 +02:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -58,12 +59,13 @@ dependencies:
|
|
58
59
|
requirements:
|
59
60
|
- - "="
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
62
|
+
hash: 977940582
|
62
63
|
segments:
|
63
64
|
- 1
|
64
|
-
- 6
|
65
65
|
- 7
|
66
|
-
|
66
|
+
- 0
|
67
|
+
- rc1
|
68
|
+
version: 1.7.0.rc1
|
67
69
|
type: :runtime
|
68
70
|
version_requirements: *id003
|
69
71
|
- !ruby/object:Gem::Dependency
|
@@ -74,12 +76,13 @@ dependencies:
|
|
74
76
|
requirements:
|
75
77
|
- - "="
|
76
78
|
- !ruby/object:Gem::Version
|
77
|
-
hash:
|
79
|
+
hash: 977940582
|
78
80
|
segments:
|
79
81
|
- 1
|
80
|
-
- 6
|
81
82
|
- 7
|
82
|
-
|
83
|
+
- 0
|
84
|
+
- rc1
|
85
|
+
version: 1.7.0.rc1
|
83
86
|
type: :runtime
|
84
87
|
version_requirements: *id004
|
85
88
|
- !ruby/object:Gem::Dependency
|
@@ -149,12 +152,14 @@ files:
|
|
149
152
|
- lib/watir/winClicker.rb
|
150
153
|
- lib/watir/WindowHelper.rb
|
151
154
|
- lib/watir/AutoItX3.dll
|
155
|
+
- lib/watir/AutoItX.chm
|
152
156
|
- unittests/all_tests.rb
|
153
157
|
- unittests/buttons_xpath_test.rb
|
154
158
|
- unittests/checkbox_test.rb
|
155
159
|
- unittests/checkbox_xpath_test.rb
|
156
160
|
- unittests/click_no_wait_test.rb
|
157
161
|
- unittests/core_tests.rb
|
162
|
+
- unittests/css_selector_test.rb
|
158
163
|
- unittests/css_test.rb
|
159
164
|
- unittests/defer_test.rb
|
160
165
|
- unittests/dialog_test.rb
|
@@ -330,12 +335,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
331
336
|
none: false
|
332
337
|
requirements:
|
333
|
-
- - "
|
338
|
+
- - ">"
|
334
339
|
- !ruby/object:Gem::Version
|
335
|
-
hash:
|
340
|
+
hash: 25
|
336
341
|
segments:
|
337
|
-
-
|
338
|
-
|
342
|
+
- 1
|
343
|
+
- 3
|
344
|
+
- 1
|
345
|
+
version: 1.3.1
|
339
346
|
requirements:
|
340
347
|
- Microsoft Windows running Internet Explorer 5.5 or later.
|
341
348
|
rubyforge_project: Watir
|