watir-classic 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/Gemfile.lock +78 -78
- data/VERSION +1 -1
- data/lib/watir-classic/cookies.rb +3 -1
- data/lib/watir-classic/element.rb +10 -3
- data/lib/watir-classic/ie.rb +1 -1
- data/lib/watir-classic/image.rb +1 -2
- data/lib/watir-classic/link.rb +2 -2
- data/lib/watir-classic/page-container.rb +2 -2
- data/spec/element_spec.rb +19 -0
- data/spec/link_spec.rb +14 -0
- data/spec/select_list_spec.rb +18 -0
- data/watir-classic.gemspec +1 -1
- metadata +9 -3
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 3.3.0 - 2012/10/27
|
2
|
+
|
3
|
+
* Add support for optional Element#style property argument, which allows to get specific css style attribute value.
|
4
|
+
* Add support for locating Link by a :name. Fixes #42.
|
5
|
+
* Avoid endless loop when focusing elements inside of a frame. Closes #41.
|
6
|
+
* Cookies#delete handles the situation if browser is on about:blank.
|
7
|
+
* Remove Image#file_created_date method since IE does not provide accurate information. Closes #36.
|
8
|
+
* Use MultiJSON gem instead of the Yajl::Ruby gem as a dependency for parsing #execute_script results.
|
9
|
+
|
1
10
|
== 3.2.0 - 2012/09/17
|
2
11
|
|
3
12
|
* Add Element#browser method as an alias for Element#page_container.
|
data/Gemfile.lock
CHANGED
@@ -1,78 +1,78 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
watir-classic (3.2.0
|
5
|
-
ffi (~> 1.0)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
GEM
|
15
|
-
remote: http://rubygems.org/
|
16
|
-
specs:
|
17
|
-
builder (3.
|
18
|
-
childprocess (0.3.4)
|
19
|
-
ffi (~> 1.0, >= 1.0.6)
|
20
|
-
diff-lcs (1.1.3)
|
21
|
-
ffi (1.1.3-x86-mingw32)
|
22
|
-
hoe (3.0.8)
|
23
|
-
rake (~> 0.8)
|
24
|
-
mini_magick (3.2.1)
|
25
|
-
subexec (~> 0.0.4)
|
26
|
-
|
27
|
-
|
28
|
-
rack
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
rspec-
|
35
|
-
rspec-
|
36
|
-
|
37
|
-
rspec-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
rack
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
win32-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
yard (0.8.2.1)
|
68
|
-
|
69
|
-
PLATFORMS
|
70
|
-
x86-mingw32
|
71
|
-
|
72
|
-
DEPENDENCIES
|
73
|
-
childprocess
|
74
|
-
rspec (~> 2.3)
|
75
|
-
sinatra
|
76
|
-
syntax
|
77
|
-
watir-classic!
|
78
|
-
yard
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
watir-classic (3.2.0)
|
5
|
+
ffi (~> 1.0)
|
6
|
+
multi_json
|
7
|
+
nokogiri
|
8
|
+
rautomation (~> 0.7.2)
|
9
|
+
user-choices
|
10
|
+
win32-process (>= 0.5.5)
|
11
|
+
win32screenshot
|
12
|
+
windows-pr (>= 0.6.6)
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: http://rubygems.org/
|
16
|
+
specs:
|
17
|
+
builder (3.1.3)
|
18
|
+
childprocess (0.3.4)
|
19
|
+
ffi (~> 1.0, >= 1.0.6)
|
20
|
+
diff-lcs (1.1.3)
|
21
|
+
ffi (1.1.3-x86-mingw32)
|
22
|
+
hoe (3.0.8)
|
23
|
+
rake (~> 0.8)
|
24
|
+
mini_magick (3.2.1)
|
25
|
+
subexec (~> 0.0.4)
|
26
|
+
multi_json (1.3.6)
|
27
|
+
nokogiri (1.5.5-x86-mingw32)
|
28
|
+
rack (1.4.1)
|
29
|
+
rack-protection (1.2.0)
|
30
|
+
rack
|
31
|
+
rake (0.9.2.2)
|
32
|
+
rautomation (0.7.2)
|
33
|
+
rspec (2.11.0)
|
34
|
+
rspec-core (~> 2.11.0)
|
35
|
+
rspec-expectations (~> 2.11.0)
|
36
|
+
rspec-mocks (~> 2.11.0)
|
37
|
+
rspec-core (2.11.1)
|
38
|
+
rspec-expectations (2.11.2)
|
39
|
+
diff-lcs (~> 1.1.3)
|
40
|
+
rspec-mocks (2.11.1)
|
41
|
+
s4t-utils (1.0.4)
|
42
|
+
hoe (>= 1.3.0)
|
43
|
+
sinatra (1.3.2)
|
44
|
+
rack (~> 1.3, >= 1.3.6)
|
45
|
+
rack-protection (~> 1.2)
|
46
|
+
tilt (~> 1.3, >= 1.3.3)
|
47
|
+
subexec (0.0.4)
|
48
|
+
syntax (1.0.0)
|
49
|
+
tilt (1.3.3)
|
50
|
+
user-choices (1.1.6.1)
|
51
|
+
builder (>= 2.1.2)
|
52
|
+
s4t-utils (>= 1.0.3)
|
53
|
+
xml-simple (>= 1.0.11)
|
54
|
+
win32-api (1.4.8-x86-mingw32)
|
55
|
+
win32-process (0.7.0)
|
56
|
+
ffi (>= 1.0.0)
|
57
|
+
win32screenshot (1.0.7)
|
58
|
+
ffi (~> 1.0)
|
59
|
+
mini_magick (~> 3.2.1)
|
60
|
+
rautomation (~> 0.7.0)
|
61
|
+
windows-api (0.4.2)
|
62
|
+
win32-api (>= 1.4.5)
|
63
|
+
windows-pr (1.2.2)
|
64
|
+
win32-api (>= 1.4.5)
|
65
|
+
windows-api (>= 0.3.0)
|
66
|
+
xml-simple (1.1.1)
|
67
|
+
yard (0.8.2.1)
|
68
|
+
|
69
|
+
PLATFORMS
|
70
|
+
x86-mingw32
|
71
|
+
|
72
|
+
DEPENDENCIES
|
73
|
+
childprocess
|
74
|
+
rspec (~> 2.3)
|
75
|
+
sinatra
|
76
|
+
syntax
|
77
|
+
watir-classic!
|
78
|
+
yard
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.0
|
@@ -39,6 +39,7 @@ module Watir
|
|
39
39
|
# there's got to be some easier way to do this
|
40
40
|
uri = URI.parse(@page_container.url)
|
41
41
|
domain = uri.host
|
42
|
+
return unless domain
|
42
43
|
|
43
44
|
paths = uri.path.split("/").reduce([]) do |paths, path|
|
44
45
|
paths << "#{paths.last}/#{path}".squeeze("/")
|
@@ -71,10 +72,11 @@ module Watir
|
|
71
72
|
each {|cookie| delete cookie[:name]}
|
72
73
|
end
|
73
74
|
|
75
|
+
private
|
76
|
+
|
74
77
|
def delete_with_options name, options={}
|
75
78
|
add name, nil, options
|
76
79
|
end
|
77
80
|
|
78
|
-
private :delete_with_options
|
79
81
|
end
|
80
82
|
end
|
@@ -113,9 +113,16 @@ module Watir
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# return the css style as a string
|
116
|
-
def style
|
116
|
+
def style(property=nil)
|
117
117
|
assert_exists
|
118
|
-
ole_object.style.cssText
|
118
|
+
css = ole_object.style.cssText
|
119
|
+
|
120
|
+
if property
|
121
|
+
properties = Hash[css.downcase.split(";").map { |p| p.split(":").map(&:strip) }]
|
122
|
+
properties[property]
|
123
|
+
else
|
124
|
+
css
|
125
|
+
end
|
119
126
|
end
|
120
127
|
|
121
128
|
# Return the innerText of the object or an empty string if the object is
|
@@ -343,7 +350,7 @@ module Watir
|
|
343
350
|
def focus
|
344
351
|
assert_exists
|
345
352
|
assert_enabled
|
346
|
-
@
|
353
|
+
@container.focus
|
347
354
|
ole_object.focus(0)
|
348
355
|
end
|
349
356
|
|
data/lib/watir-classic/ie.rb
CHANGED
@@ -3,7 +3,7 @@ require 'watir-classic/core'
|
|
3
3
|
require 'watir-classic/close_all'
|
4
4
|
require 'watir-classic/ie-process'
|
5
5
|
require 'watir-classic/screenshot'
|
6
|
-
require '
|
6
|
+
require 'multi_json'
|
7
7
|
|
8
8
|
# these switches need to be deleted from ARGV to enable the Test::Unit
|
9
9
|
# functionality that grabs
|
data/lib/watir-classic/image.rb
CHANGED
@@ -8,7 +8,6 @@ module Watir
|
|
8
8
|
class Image < Element
|
9
9
|
attr_ole :alt
|
10
10
|
attr_ole :src
|
11
|
-
attr_ole :file_created_date, :fileCreatedDate
|
12
11
|
|
13
12
|
# this method produces the properties for an image as an array
|
14
13
|
def image_string_creator
|
@@ -55,7 +54,7 @@ module Watir
|
|
55
54
|
# If the Disk cache is full (tools menu -> Internet options -> Temporary Internet Files), it may produce incorrect responses.
|
56
55
|
def loaded?
|
57
56
|
assert_exists
|
58
|
-
|
57
|
+
file_size != -1
|
59
58
|
end
|
60
59
|
|
61
60
|
# this method highlights the image (in fact it adds or removes a border around the image)
|
data/lib/watir-classic/link.rb
CHANGED
@@ -7,12 +7,12 @@ module Watir
|
|
7
7
|
class Link < Element
|
8
8
|
attr_ole :type
|
9
9
|
attr_ole :href
|
10
|
+
attr_ole :name
|
10
11
|
|
11
12
|
# if an image is used as part of the link, this will return true
|
12
13
|
def link_has_image
|
13
14
|
assert_exists
|
14
|
-
|
15
|
-
return false
|
15
|
+
@o.getElementsByTagName("IMG").length > 0
|
16
16
|
end
|
17
17
|
|
18
18
|
# this method returns the src of an image, if an image is used as part of the link
|
@@ -47,7 +47,7 @@ module Watir
|
|
47
47
|
result = document.getElementById(wrapper).innerHTML
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
MultiJson.load(result)["value"] rescue nil
|
51
51
|
end
|
52
52
|
|
53
53
|
# The HTML of the current page
|
@@ -99,7 +99,7 @@ module Watir
|
|
99
99
|
document.getElementsByTagName('head')[0].appendChild(json2)
|
100
100
|
}
|
101
101
|
|
102
|
-
return JSON.stringify((function() {#{source}})());
|
102
|
+
return JSON.stringify({value: (function() {#{source}})()});
|
103
103
|
})()
|
104
104
|
]
|
105
105
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe "Element" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.url_for("non_control_elements.html"))
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#style" do
|
11
|
+
it "returns the style attribute if the property exists" do
|
12
|
+
el = browser.div(:id, 'best_language')
|
13
|
+
el.style("color").should == "red"
|
14
|
+
el.style("text-decoration").should == "underline"
|
15
|
+
el.style("cursor").should == "pointer"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/spec/link_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe "Link" do
|
5
|
+
before do
|
6
|
+
browser.goto(WatirSpec.url_for("non_control_elements.html"))
|
7
|
+
end
|
8
|
+
|
9
|
+
context "#exists?" do
|
10
|
+
it "finds link by a name" do
|
11
|
+
browser.a(:name => "bad_attribute").should exist
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe "SelectList" do
|
5
|
+
before do
|
6
|
+
browser.goto(WatirSpec.url_for("frames.html"))
|
7
|
+
end
|
8
|
+
|
9
|
+
context "#select" do
|
10
|
+
it "selects option within frame" do
|
11
|
+
list = browser.frame.select_list
|
12
|
+
list.should exist
|
13
|
+
list.should be_selected("value1")
|
14
|
+
list.select "value2"
|
15
|
+
list.should be_selected("value2")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/watir-classic.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency 'ffi', '~>1.0'
|
30
30
|
s.add_dependency 'rautomation', '~>0.7.2'
|
31
31
|
s.add_dependency 'user-choices'
|
32
|
-
s.add_dependency '
|
32
|
+
s.add_dependency 'multi_json'
|
33
33
|
s.add_dependency 'win32screenshot'
|
34
34
|
|
35
35
|
s.add_development_dependency("rspec", "~>2.3")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-classic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: win32-process
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: multi_json
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
@@ -303,7 +303,10 @@ files:
|
|
303
303
|
- lib/watir-classic/window.rb
|
304
304
|
- lib/watir-classic/xpath_locator.rb
|
305
305
|
- spec/browser_spec.rb
|
306
|
+
- spec/element_spec.rb
|
306
307
|
- spec/implementation.rb
|
308
|
+
- spec/link_spec.rb
|
309
|
+
- spec/select_list_spec.rb
|
307
310
|
- watir-classic.gemspec
|
308
311
|
- watir.gif
|
309
312
|
homepage: http://watir.com/
|
@@ -333,5 +336,8 @@ specification_version: 3
|
|
333
336
|
summary: Automated testing tool for web applications.
|
334
337
|
test_files:
|
335
338
|
- spec/browser_spec.rb
|
339
|
+
- spec/element_spec.rb
|
336
340
|
- spec/implementation.rb
|
341
|
+
- spec/link_spec.rb
|
342
|
+
- spec/select_list_spec.rb
|
337
343
|
has_rdoc:
|