watir-webdriver 0.9.0 → 0.9.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.
- checksums.yaml +4 -4
- data/.travis.yml +9 -9
- data/CHANGES.md +6 -0
- data/lib/watir-webdriver/elements/button.rb +0 -10
- data/lib/watir-webdriver/elements/element.rb +2 -1
- data/lib/watir-webdriver/elements/input.rb +0 -10
- data/lib/watir-webdriver/elements/select.rb +10 -17
- data/lib/watir-webdriver/version.rb +1 -1
- data/spec/always_locate_spec.rb +1 -1
- data/spec/click_spec.rb +1 -1
- data/spec/element_spec.rb +23 -5
- data/spec/special_chars_spec.rb +1 -1
- data/support/travis.sh +1 -1
- metadata +3 -11
- data/spec/html/clicks.html +0 -19
- data/spec/html/hover.html +0 -12
- data/spec/html/removed_element.html +0 -24
- data/spec/html/special_chars.html +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69667d301519d6ffd4340fe0187d9989d72cd0b5
|
4
|
+
data.tar.gz: 27ec93300295d47e1334fe0a92be7d40fceb9811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 103bf16805460dd31e2e2c2151701c1eaaac607544868879a3e77ed83c85aa96b143d46d398355cca5eb024a5d16173bd7d05c7ac2a41bdb609de140c8ab6d1d
|
7
|
+
data.tar.gz: fac256f75d40768e6df698add77dbc0032cad9a48b3ef4f2878824e9c807c6c92b12ce137be68ec4a4aeddd6adb15a3ab85d0f8e81e651afc6f8de3eb6b05998
|
data/.travis.yml
CHANGED
@@ -18,13 +18,13 @@ notifications:
|
|
18
18
|
before_script: support/travis.sh
|
19
19
|
script: bundle exec rake $RAKE_TASK
|
20
20
|
env:
|
21
|
-
- RAKE_TASK=spec
|
22
|
-
- RAKE_TASK=spec
|
23
|
-
- RAKE_TASK=spec
|
24
|
-
- RAKE_TASK=spec
|
25
|
-
- RAKE_TASK=spec
|
26
|
-
- RAKE_TASK=spec
|
27
|
-
- RAKE_TASK=spec
|
28
|
-
- RAKE_TASK=spec
|
29
|
-
- RAKE_TASK=spec
|
21
|
+
- RAKE_TASK=spec:firefox
|
22
|
+
- RAKE_TASK=spec:firefox ALWAYS_LOCATE=false
|
23
|
+
- RAKE_TASK=spec:firefox PREFER_CSS=1 SELECTOR_STATS=1
|
24
|
+
- RAKE_TASK=spec:chrome
|
25
|
+
- RAKE_TASK=spec:chrome ALWAYS_LOCATE=false
|
26
|
+
- RAKE_TASK=spec:chrome PREFER_CSS=1 SELECTOR_STATS=1
|
27
|
+
- RAKE_TASK=spec:phantomjs
|
28
|
+
- RAKE_TASK=spec:phantomjs ALWAYS_LOCATE=false
|
29
|
+
- RAKE_TASK=spec:phantomjs PREFER_CSS=1 SELECTOR_STATS=1
|
30
30
|
- RAKE_TASK=yard:doctest
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.9.1 (2015-10-14)
|
2
|
+
|
3
|
+
* Fix permissions issue with element_locator file(#381)
|
4
|
+
* Trying to select a disabled option now raises `ObjectDisabledException` (#378)
|
5
|
+
* `Element#enabled?` raises `UnknownObjectException` if element is not present (#379)
|
6
|
+
|
1
7
|
### 0.9.0 (2015-10-08)
|
2
8
|
|
3
9
|
* Improve performance for Select#include? (#375, thanks @Conky5)
|
@@ -2,16 +2,6 @@ module Watir
|
|
2
2
|
class Select < HTMLElement
|
3
3
|
include Watir::Exception
|
4
4
|
|
5
|
-
#
|
6
|
-
# Returns true if this element is enabled
|
7
|
-
#
|
8
|
-
# @return [Boolean]
|
9
|
-
#
|
10
|
-
|
11
|
-
def enabled?
|
12
|
-
!disabled?
|
13
|
-
end
|
14
|
-
|
15
5
|
#
|
16
6
|
# Clears all selected options.
|
17
7
|
#
|
@@ -22,7 +12,7 @@ module Watir
|
|
22
12
|
raise Error, "you can only clear multi-selects" unless multiple?
|
23
13
|
|
24
14
|
options.each do |o|
|
25
|
-
o
|
15
|
+
click_option(o) if o.selected?
|
26
16
|
end
|
27
17
|
end
|
28
18
|
|
@@ -156,7 +146,7 @@ module Watir
|
|
156
146
|
end
|
157
147
|
no_value_found(string) if elements.empty?
|
158
148
|
|
159
|
-
elements.each { |e| e
|
149
|
+
elements.each { |e| click_option(e) unless e.selected? }
|
160
150
|
elements.first.text
|
161
151
|
else
|
162
152
|
begin
|
@@ -167,8 +157,7 @@ module Watir
|
|
167
157
|
no_value_found(string)
|
168
158
|
end
|
169
159
|
|
170
|
-
e
|
171
|
-
|
160
|
+
click_option(e) unless e.selected?
|
172
161
|
safe_text(e)
|
173
162
|
end
|
174
163
|
end
|
@@ -182,7 +171,7 @@ module Watir
|
|
182
171
|
if multiple?
|
183
172
|
found = elements.select do |e|
|
184
173
|
next unless matches_regexp?(how, e, exp)
|
185
|
-
e
|
174
|
+
click_option(e) unless e.selected?
|
186
175
|
true
|
187
176
|
end
|
188
177
|
|
@@ -193,8 +182,7 @@ module Watir
|
|
193
182
|
element = elements.find { |e| matches_regexp?(how, e, exp) }
|
194
183
|
no_value_found(exp) unless element
|
195
184
|
|
196
|
-
element
|
197
|
-
|
185
|
+
click_option(element) unless element.selected?
|
198
186
|
safe_text(element)
|
199
187
|
end
|
200
188
|
end
|
@@ -223,6 +211,11 @@ module Watir
|
|
223
211
|
end
|
224
212
|
end
|
225
213
|
|
214
|
+
def click_option(element)
|
215
|
+
element = Option.new(self, element: element) unless element.is_a?(Option)
|
216
|
+
element.click
|
217
|
+
end
|
218
|
+
|
226
219
|
def safe_text(element)
|
227
220
|
element.text
|
228
221
|
rescue Selenium::WebDriver::Error::StaleElementReferenceError, Selenium::WebDriver::Error::UnhandledAlertError
|
data/spec/always_locate_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe 'Watir' do
|
|
4
4
|
describe '#always_locate?' do
|
5
5
|
|
6
6
|
before do
|
7
|
-
browser.goto WatirSpec.url_for('removed_element.html'
|
7
|
+
browser.goto WatirSpec.url_for('removed_element.html')
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'determines whether #exist? returns false for stale element' do
|
data/spec/click_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../watirspec/spec_helper', __FILE__)
|
|
3
3
|
describe Watir::Element do
|
4
4
|
describe "#click" do
|
5
5
|
before {
|
6
|
-
browser.goto WatirSpec.url_for('clicks.html'
|
6
|
+
browser.goto WatirSpec.url_for('clicks.html')
|
7
7
|
}
|
8
8
|
|
9
9
|
let(:clicker) { browser.element(id: "click-logger") }
|
data/spec/element_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Watir::Element do
|
|
4
4
|
|
5
5
|
describe '#present?' do
|
6
6
|
before do
|
7
|
-
browser.goto(WatirSpec.url_for("wait.html"
|
7
|
+
browser.goto(WatirSpec.url_for("wait.html"))
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'returns true if the element exists and is visible' do
|
@@ -31,9 +31,27 @@ describe Watir::Element do
|
|
31
31
|
|
32
32
|
end
|
33
33
|
|
34
|
+
describe "#enabled?" do
|
35
|
+
before do
|
36
|
+
browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
|
37
|
+
end
|
38
|
+
|
39
|
+
it "returns true if the element is enabled" do
|
40
|
+
expect(browser.element(name: 'new_user_submit')).to be_enabled
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns false if the element is disabled" do
|
44
|
+
expect(browser.element(name: 'new_user_submit_disabled')).to_not be_enabled
|
45
|
+
end
|
46
|
+
|
47
|
+
it "raises UnknownObjectException if the element doesn't exist" do
|
48
|
+
expect { browser.element(name: "no_such_name").enabled? }.to raise_error(Watir::Exception::UnknownObjectException)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
34
52
|
describe "#reset!" do
|
35
53
|
it "successfully relocates collection elements after a reset!" do
|
36
|
-
browser.goto(WatirSpec.url_for("wait.html"
|
54
|
+
browser.goto(WatirSpec.url_for("wait.html"))
|
37
55
|
element = browser.div(:id, 'foo')
|
38
56
|
expect(element).to exist
|
39
57
|
browser.refresh
|
@@ -45,7 +63,7 @@ describe Watir::Element do
|
|
45
63
|
|
46
64
|
describe "#exists?" do
|
47
65
|
before do
|
48
|
-
browser.goto WatirSpec.url_for('removed_element.html'
|
66
|
+
browser.goto WatirSpec.url_for('removed_element.html')
|
49
67
|
end
|
50
68
|
|
51
69
|
it "does not propagate StaleElementReferenceErrors" do
|
@@ -93,7 +111,7 @@ describe Watir::Element do
|
|
93
111
|
describe "#element_call" do
|
94
112
|
|
95
113
|
it 'handles exceptions when taking an action on an element that goes stale during execution' do
|
96
|
-
browser.goto WatirSpec.url_for('removed_element.html'
|
114
|
+
browser.goto WatirSpec.url_for('removed_element.html')
|
97
115
|
|
98
116
|
watir_element = browser.div(id: "text")
|
99
117
|
|
@@ -119,7 +137,7 @@ describe Watir::Element do
|
|
119
137
|
%i(webdriver iphone),
|
120
138
|
%i(webdriver safari) do
|
121
139
|
it "should hover over the element" do
|
122
|
-
browser.goto WatirSpec.url_for('hover.html'
|
140
|
+
browser.goto WatirSpec.url_for('hover.html')
|
123
141
|
link = browser.a
|
124
142
|
|
125
143
|
expect(link.style("font-size")).to eq "10px"
|
data/spec/special_chars_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))
|
|
3
3
|
describe Watir::Browser do
|
4
4
|
|
5
5
|
before do
|
6
|
-
browser.goto WatirSpec.url_for("special_chars.html"
|
6
|
+
browser.goto WatirSpec.url_for("special_chars.html")
|
7
7
|
end
|
8
8
|
|
9
9
|
it "finds elements with single quotes" do
|
data/support/travis.sh
CHANGED
@@ -9,7 +9,7 @@ git submodule update --init
|
|
9
9
|
mkdir ~/.yard
|
10
10
|
bundle exec yard config -a autoload_plugins yard-doctest
|
11
11
|
|
12
|
-
if [[ "$
|
12
|
+
if [[ "$RAKE_TASK" = "spec:chrome" ]]; then
|
13
13
|
export CHROME_REVISION=`curl -s http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE`
|
14
14
|
export CHROMEDRIVER_VERSION=`curl -s http://chromedriver.storage.googleapis.com/LATEST_RELEASE`
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -276,10 +276,6 @@ files:
|
|
276
276
|
- spec/container_spec.rb
|
277
277
|
- spec/element_locator_spec.rb
|
278
278
|
- spec/element_spec.rb
|
279
|
-
- spec/html/clicks.html
|
280
|
-
- spec/html/hover.html
|
281
|
-
- spec/html/removed_element.html
|
282
|
-
- spec/html/special_chars.html
|
283
279
|
- spec/implementation.rb
|
284
280
|
- spec/input_spec.rb
|
285
281
|
- spec/locator_spec_helper.rb
|
@@ -309,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
309
305
|
version: '0'
|
310
306
|
requirements: []
|
311
307
|
rubyforge_project: watir-webdriver
|
312
|
-
rubygems_version: 2.4.
|
308
|
+
rubygems_version: 2.4.8
|
313
309
|
signing_key:
|
314
310
|
specification_version: 4
|
315
311
|
summary: Watir on WebDriver
|
@@ -320,10 +316,6 @@ test_files:
|
|
320
316
|
- spec/container_spec.rb
|
321
317
|
- spec/element_locator_spec.rb
|
322
318
|
- spec/element_spec.rb
|
323
|
-
- spec/html/clicks.html
|
324
|
-
- spec/html/hover.html
|
325
|
-
- spec/html/removed_element.html
|
326
|
-
- spec/html/special_chars.html
|
327
319
|
- spec/implementation.rb
|
328
320
|
- spec/input_spec.rb
|
329
321
|
- spec/locator_spec_helper.rb
|
data/spec/html/clicks.html
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<script src="../watirspec/html/javascript/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
|
4
|
-
</head>
|
5
|
-
<script>
|
6
|
-
$(document).ready(function() {
|
7
|
-
$("#click-logger").click(function(evt) {
|
8
|
-
$("#log").append("<p>shift=" + evt.shiftKey + " alt=" + evt.altKey + "</p>");
|
9
|
-
});
|
10
|
-
});
|
11
|
-
</script>
|
12
|
-
<body>
|
13
|
-
<div id="click-logger">click me</div>
|
14
|
-
<div id="log"></div>
|
15
|
-
<div>
|
16
|
-
<div onclick="this.innerHTML = 'You Clicked It!'" style="color: red; text-decoration: underline; cursor: pointer;">Can You Click This?</div>
|
17
|
-
</div>
|
18
|
-
</body>
|
19
|
-
</html>
|
data/spec/html/hover.html
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
<!DOCTYPE HTML>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>obsolete element</title>
|
5
|
-
<script type="text/javascript" charset="utf-8">
|
6
|
-
function removeText() {
|
7
|
-
var e = document.getElementById("text");
|
8
|
-
e.parentNode.removeChild(e);
|
9
|
-
}
|
10
|
-
</script>
|
11
|
-
</head>
|
12
|
-
|
13
|
-
<body>
|
14
|
-
<button id='remove-button' onclick="removeText()">Remove text</button>
|
15
|
-
<div id="text">Text</div>
|
16
|
-
|
17
|
-
<div id='top'>Top Element>
|
18
|
-
<div id='middle'>Middle Element>
|
19
|
-
<div id='bottom'>Bottom Element</div>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
</body>
|
24
|
-
</html>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
-
<title>Special Chars</title>
|
6
|
-
</head>
|
7
|
-
|
8
|
-
<body>
|
9
|
-
<div id='single-quote'>single 'quotes'</div>
|
10
|
-
<div id='double-quote'>double "quotes"</div>
|
11
|
-
</body>
|
12
|
-
</html>
|