selenium-webdriver 2.13.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +20 -0
- data/lib/selenium/webdriver.rb +1 -22
- data/lib/selenium/webdriver/android/bridge.rb +5 -0
- data/lib/selenium/webdriver/chrome/bridge.rb +2 -0
- data/lib/selenium/webdriver/chrome/profile.rb +2 -2
- data/lib/selenium/webdriver/common/driver.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -0
- data/lib/selenium/webdriver/common/element.rb +1 -1
- data/lib/selenium/webdriver/common/error.rb +133 -12
- data/lib/selenium/webdriver/common/file_reaper.rb +5 -0
- data/lib/selenium/webdriver/common/options.rb +3 -3
- data/lib/selenium/webdriver/common/profile_helper.rb +3 -3
- data/lib/selenium/webdriver/common/proxy.rb +4 -0
- data/lib/selenium/webdriver/common/search_context.rb +4 -3
- data/lib/selenium/webdriver/common/socket_poller.rb +1 -0
- data/lib/selenium/webdriver/common/zipper.rb +4 -0
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/profile.rb +1 -1
- data/lib/selenium/webdriver/ie/native/win32/IEDriver.dll +0 -0
- data/lib/selenium/webdriver/ie/native/x64/IEDriver.dll +0 -0
- data/lib/selenium/webdriver/iphone/bridge.rb +4 -0
- data/lib/selenium/webdriver/remote/capabilities.rb +10 -2
- data/lib/selenium/webdriver/remote/http/common.rb +2 -2
- data/lib/selenium/webdriver/support.rb +2 -1
- data/lib/selenium/webdriver/support/select.rb +218 -227
- metadata +194 -237
data/CHANGES
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
2.14.0 (???)
|
2
|
+
===================
|
3
|
+
|
4
|
+
* Add Selenium::WebDriver::Support::Select class to ease working with select lists.
|
5
|
+
* Add Capabilities.ipad and Capabilities.iphone (#2895)
|
6
|
+
* Replace json_pure dependency with multi_json. (#2901)
|
7
|
+
* Don't leave sockets hanging in SYN_SENT state while polling.
|
8
|
+
* Allow selecting option elements even if the enclosing select has zero opacity.
|
9
|
+
* Exception renames (old names aliased and will still work in rescues):
|
10
|
+
* ObsoleteElementError -> StaleElementReferenceError
|
11
|
+
* UnhandledError -> UnknownError
|
12
|
+
* UnexpectedJavascriptError -> JavascriptError
|
13
|
+
* NoAlertOpenError -> NoAlertPresentError
|
14
|
+
* ElementNotDisplayedError -> ElementNotVisibleError
|
15
|
+
* Firefox:
|
16
|
+
* Fixed issue with scrolling on small viewports with native events.
|
17
|
+
* Fix CSS selector support in Firefox 3.0
|
18
|
+
* IE:
|
19
|
+
* Implement the window control API
|
20
|
+
|
1
21
|
2.13.0 (2011-11-18)
|
2
22
|
===================
|
3
23
|
|
data/lib/selenium/webdriver.rb
CHANGED
@@ -3,28 +3,7 @@ require 'tmpdir'
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'date'
|
5
5
|
|
6
|
-
|
7
|
-
begin
|
8
|
-
require lib
|
9
|
-
true
|
10
|
-
rescue LoadError
|
11
|
-
false
|
12
|
-
end
|
13
|
-
}
|
14
|
-
|
15
|
-
unless have_lib['yajl/json_gem'] || have_lib['json']
|
16
|
-
raise LoadError, <<-END
|
17
|
-
|
18
|
-
You need to require rubygems or install one of these gems:
|
19
|
-
|
20
|
-
yajl-ruby (best on MRI)
|
21
|
-
json
|
22
|
-
json-jruby (native JRuby)
|
23
|
-
json_pure (any platform)
|
24
|
-
|
25
|
-
END
|
26
|
-
end
|
27
|
-
|
6
|
+
require 'multi_json'
|
28
7
|
require 'selenium/webdriver/common'
|
29
8
|
|
30
9
|
module Selenium
|
@@ -61,7 +61,7 @@ module Selenium
|
|
61
61
|
prefs_file = prefs_file_for(dir)
|
62
62
|
|
63
63
|
FileUtils.mkdir_p File.dirname(prefs_file)
|
64
|
-
File.open(prefs_file, "w") { |file| file << prefs
|
64
|
+
File.open(prefs_file, "w") { |file| file << MultiJson.encode(prefs) }
|
65
65
|
end
|
66
66
|
|
67
67
|
def prefs
|
@@ -70,7 +70,7 @@ module Selenium
|
|
70
70
|
|
71
71
|
def read_model_prefs
|
72
72
|
return {} unless @model
|
73
|
-
|
73
|
+
MultiJson.decode File.read(prefs_file_for(@model))
|
74
74
|
end
|
75
75
|
|
76
76
|
def prefs_file_for(dir)
|
@@ -3,43 +3,149 @@ module Selenium
|
|
3
3
|
module Error
|
4
4
|
|
5
5
|
class WebDriverError < StandardError; end
|
6
|
+
class UnsupportedOperationError < WebDriverError; end
|
7
|
+
|
6
8
|
class IndexOutOfBoundsError < WebDriverError; end # 1
|
7
9
|
class NoCollectionError < WebDriverError; end # 2
|
8
10
|
class NoStringError < WebDriverError; end # 3
|
9
11
|
class NoStringLengthError < WebDriverError; end # 4
|
10
12
|
class NoStringWrapperError < WebDriverError; end # 5
|
11
13
|
class NoSuchDriverError < WebDriverError; end # 6
|
14
|
+
|
15
|
+
#
|
16
|
+
# An element could not be located on the page using the given search
|
17
|
+
# parameters.
|
18
|
+
#
|
19
|
+
|
12
20
|
class NoSuchElementError < WebDriverError; end # 7
|
21
|
+
|
22
|
+
#
|
23
|
+
# A request to switch to a frame could not be satisfied because the
|
24
|
+
# frame could not be found.
|
25
|
+
#
|
26
|
+
|
13
27
|
class NoSuchFrameError < WebDriverError; end # 8
|
14
28
|
class UnknownCommandError < WebDriverError; end # 9
|
15
|
-
|
16
|
-
|
29
|
+
|
30
|
+
|
31
|
+
#
|
32
|
+
# Indicates that a reference to an element is now "stale" - the element
|
33
|
+
# no longer appears in the DOM of the page.
|
34
|
+
#
|
35
|
+
|
36
|
+
class StaleElementReferenceError < WebDriverError; end # 10
|
37
|
+
|
38
|
+
#
|
39
|
+
# Raised to indicate that although an element is present on the DOM,
|
40
|
+
# it is not visible, and so is not able to be interacted with.
|
41
|
+
#
|
42
|
+
|
43
|
+
class ElementNotVisibleError < WebDriverError; end # 11
|
44
|
+
|
45
|
+
#
|
46
|
+
# Raised when an interaction could not be performed because the element
|
47
|
+
# is in an invalid state (e.g. attempting to click a disabled element).
|
48
|
+
#
|
49
|
+
|
17
50
|
class InvalidElementStateError < WebDriverError; end # 12
|
18
|
-
|
51
|
+
|
52
|
+
#
|
53
|
+
# An unknown server-side error occurred while processing the command.
|
54
|
+
#
|
55
|
+
|
56
|
+
class UnknownError < WebDriverError; end # 13
|
19
57
|
class ExpectedError < WebDriverError; end # 14
|
58
|
+
|
59
|
+
#
|
60
|
+
# An attempt was made to select an element that cannot be selected.
|
61
|
+
#
|
62
|
+
|
20
63
|
class ElementNotSelectableError < WebDriverError; end # 15
|
21
64
|
class NoSuchDocumentError < WebDriverError; end # 16
|
22
|
-
|
65
|
+
|
66
|
+
#
|
67
|
+
# An error occurred while executing user supplied JavaScript.
|
68
|
+
#
|
69
|
+
|
70
|
+
class JavascriptError < WebDriverError; end # 17
|
23
71
|
class NoScriptResultError < WebDriverError; end # 18
|
72
|
+
|
73
|
+
#
|
74
|
+
# An error occurred while searching for an element by XPath.
|
75
|
+
#
|
76
|
+
|
24
77
|
class XPathLookupError < WebDriverError; end # 19
|
25
78
|
class NoSuchCollectionError < WebDriverError; end # 20
|
79
|
+
|
80
|
+
#
|
81
|
+
# Raised when a command does not complete in enough time.
|
82
|
+
#
|
83
|
+
|
26
84
|
class TimeOutError < WebDriverError; end # 21
|
27
85
|
class NullPointerError < WebDriverError; end # 22
|
28
86
|
class NoSuchWindowError < WebDriverError; end # 23
|
87
|
+
|
88
|
+
#
|
89
|
+
# Raised when attempting to add a cookie under a different domain than
|
90
|
+
# the current URL.
|
91
|
+
#
|
92
|
+
|
29
93
|
class InvalidCookieDomainError < WebDriverError; end # 24
|
94
|
+
|
95
|
+
#
|
96
|
+
# Raised when a driver fails to set a cookie.
|
97
|
+
#
|
98
|
+
|
30
99
|
class UnableToSetCookieError < WebDriverError; end # 25
|
31
100
|
class UnexpectedAlertError < WebDriverError; end # 26
|
32
|
-
|
101
|
+
|
102
|
+
#
|
103
|
+
# Indicates that a user has tried to access an alert when one is not present.
|
104
|
+
#
|
105
|
+
|
106
|
+
class NoAlertPresentError < WebDriverError; end # 27
|
107
|
+
|
108
|
+
#
|
109
|
+
# A script did not complete before its timeout expired.
|
110
|
+
#
|
111
|
+
|
33
112
|
class ScriptTimeOutError < WebDriverError; end # 28
|
113
|
+
|
114
|
+
#
|
115
|
+
# The coordinates provided to an interactions operation are invalid.
|
116
|
+
#
|
117
|
+
|
34
118
|
class InvalidElementCoordinatesError < WebDriverError; end # 29
|
119
|
+
|
120
|
+
#
|
121
|
+
# Indicates that IME support is not available. This exception is rasied
|
122
|
+
# for every IME-related method call if IME support is not available on
|
123
|
+
# the machine.
|
124
|
+
#
|
125
|
+
|
35
126
|
class IMENotAvailableError < WebDriverError; end # 30
|
127
|
+
|
128
|
+
#
|
129
|
+
# Indicates that activating an IME engine has failed.
|
130
|
+
#
|
131
|
+
|
36
132
|
class IMEEngineActivationFailedError < WebDriverError; end # 31
|
133
|
+
|
134
|
+
#
|
135
|
+
# Argument was an invalid selector (e.g. XPath/CSS).
|
136
|
+
#
|
137
|
+
|
37
138
|
class InvalidSelectorError < WebDriverError; end # 32
|
38
139
|
# 33
|
140
|
+
|
141
|
+
#
|
142
|
+
# Indicates that the target provided to the actions #move method is
|
143
|
+
# invalid, e.g. outside of the bounds of the window.
|
144
|
+
#
|
145
|
+
|
39
146
|
class MoveTargetOutOfBoundsError < WebDriverError; end # 34
|
40
|
-
|
41
|
-
class UnsupportedOperationError < WebDriverError; end
|
42
147
|
|
148
|
+
# @api private
|
43
149
|
Errors = [
|
44
150
|
IndexOutOfBoundsError, # 1
|
45
151
|
NoCollectionError, # 2
|
@@ -50,14 +156,14 @@ module Selenium
|
|
50
156
|
NoSuchElementError, # 7
|
51
157
|
NoSuchFrameError, # 8
|
52
158
|
UnknownCommandError, # 9
|
53
|
-
|
54
|
-
|
159
|
+
StaleElementReferenceError, # 10
|
160
|
+
ElementNotVisibleError, # 11
|
55
161
|
InvalidElementStateError, # 12
|
56
|
-
|
162
|
+
UnknownError, # 13
|
57
163
|
ExpectedError, # 14
|
58
164
|
ElementNotSelectableError, # 15
|
59
165
|
NoSuchDocumentError, # 16
|
60
|
-
|
166
|
+
JavascriptError, # 17
|
61
167
|
NoScriptResultError, # 18
|
62
168
|
XPathLookupError, # 19
|
63
169
|
NoSuchCollectionError, # 20
|
@@ -67,7 +173,7 @@ module Selenium
|
|
67
173
|
InvalidCookieDomainError, # 24
|
68
174
|
UnableToSetCookieError, # 25
|
69
175
|
UnexpectedAlertError, # 26
|
70
|
-
|
176
|
+
NoAlertPresentError, # 27
|
71
177
|
ScriptTimeOutError, # 28
|
72
178
|
InvalidElementCoordinatesError, # 29
|
73
179
|
IMENotAvailableError, # 30
|
@@ -77,6 +183,21 @@ module Selenium
|
|
77
183
|
MoveTargetOutOfBoundsError # 34
|
78
184
|
]
|
79
185
|
|
186
|
+
# aliased for backwards compatibility
|
187
|
+
ObsoleteElementError = StaleElementReferenceError
|
188
|
+
|
189
|
+
# aliased for backwards compatibility
|
190
|
+
UnhandledError = UnknownError
|
191
|
+
|
192
|
+
# aliased for backwards compatibility
|
193
|
+
UnexpectedJavascriptError = JavascriptError
|
194
|
+
|
195
|
+
# aliased for backwards compatibility
|
196
|
+
NoAlertOpenError = NoAlertPresentError
|
197
|
+
|
198
|
+
# aliased for backwards compatibility
|
199
|
+
ElementNotDisplayedError = ElementNotVisibleError
|
200
|
+
|
80
201
|
class << self
|
81
202
|
def for_code(code)
|
82
203
|
return if code == 0
|
@@ -30,7 +30,7 @@ module Selenium
|
|
30
30
|
opts[:path] ||= "/"
|
31
31
|
opts[:secure] ||= false
|
32
32
|
|
33
|
-
if obj = opts
|
33
|
+
if obj = opts.delete(:expires)
|
34
34
|
opts[:expiry] = seconds_from(obj)
|
35
35
|
end
|
36
36
|
|
@@ -89,10 +89,10 @@ module Selenium
|
|
89
89
|
def timeouts
|
90
90
|
@timeouts ||= Timeouts.new(@bridge)
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
#
|
94
94
|
# @api beta This API may be changed or removed in a future release.
|
95
|
-
#
|
95
|
+
#
|
96
96
|
|
97
97
|
def window
|
98
98
|
@window ||= Window.new(@bridge)
|
@@ -2,7 +2,7 @@ module Selenium
|
|
2
2
|
module WebDriver
|
3
3
|
|
4
4
|
#
|
5
|
-
# @private
|
5
|
+
# @api private
|
6
6
|
#
|
7
7
|
# Common methods for Chrome::Profile and Firefox::Profile
|
8
8
|
# Includers must implement #layout_on_disk
|
@@ -19,7 +19,7 @@ module Selenium
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_json(*args)
|
22
|
-
as_json
|
22
|
+
MultiJson.encode as_json
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -46,7 +46,7 @@ module Selenium
|
|
46
46
|
|
47
47
|
module ClassMethods
|
48
48
|
def from_json(json)
|
49
|
-
data =
|
49
|
+
data = MultiJson.decode(json).fetch('zip')
|
50
50
|
|
51
51
|
# can't use Tempfile here since it doesn't support File::BINARY mode on 1.8
|
52
52
|
# can't use Dir.mktmpdir(&blk) because of http://jira.codehaus.org/browse/JRUBY-4082
|
@@ -2,6 +2,7 @@ module Selenium
|
|
2
2
|
module WebDriver
|
3
3
|
module SearchContext
|
4
4
|
|
5
|
+
# @api private
|
5
6
|
FINDERS = {
|
6
7
|
:class => 'class name',
|
7
8
|
:class_name => 'class name',
|
@@ -25,9 +26,9 @@ module Selenium
|
|
25
26
|
#
|
26
27
|
# @param [:class, :class_name, :css, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath] how
|
27
28
|
# @param [String] what
|
28
|
-
# @return [
|
29
|
+
# @return [Element]
|
29
30
|
#
|
30
|
-
# @raise [NoSuchElementError] if the element doesn't exist
|
31
|
+
# @raise [Error::NoSuchElementError] if the element doesn't exist
|
31
32
|
#
|
32
33
|
#
|
33
34
|
|
@@ -48,7 +49,7 @@ module Selenium
|
|
48
49
|
#
|
49
50
|
# @param [:class, :class_name, :css, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath] how
|
50
51
|
# @param [String] what
|
51
|
-
# @return [Array<
|
52
|
+
# @return [Array<Element>]
|
52
53
|
#
|
53
54
|
|
54
55
|
def find_elements(*args)
|