selenium-webdriver 2.53.3 → 3.142.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +665 -8
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +2 -3
- data/lib/selenium/server.rb +76 -73
- data/lib/selenium/webdriver/atoms/getAttribute.js +7 -0
- data/lib/selenium/webdriver/atoms/isDisplayed.js +102 -0
- data/lib/selenium/webdriver/{phantomjs.rb → atoms.rb} +10 -14
- data/lib/selenium/webdriver/chrome/bridge.rb +30 -101
- data/lib/selenium/webdriver/chrome/driver.rb +127 -0
- data/lib/selenium/webdriver/chrome/options.rb +190 -0
- data/lib/selenium/webdriver/chrome/profile.rb +21 -20
- data/lib/selenium/webdriver/chrome/service.rb +26 -93
- data/lib/selenium/webdriver/chrome.rb +15 -6
- data/lib/selenium/webdriver/common/action_builder.rb +52 -58
- data/lib/selenium/webdriver/common/alert.rb +7 -15
- data/lib/selenium/webdriver/common/bridge_helper.rb +18 -22
- data/lib/selenium/webdriver/common/driver.rb +72 -72
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
- data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +11 -27
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +6 -10
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +7 -8
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +3 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -5
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +6 -9
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -7
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -8
- data/lib/selenium/webdriver/common/element.rb +59 -39
- data/lib/selenium/webdriver/common/error.rb +259 -104
- data/lib/selenium/webdriver/common/file_reaper.rb +6 -14
- data/lib/selenium/webdriver/common/html5/local_storage.rb +8 -10
- data/lib/selenium/webdriver/common/html5/session_storage.rb +8 -10
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +8 -16
- data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
- data/lib/selenium/webdriver/{safari/browser.rb → common/interactions/interactions.rb} +17 -14
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
- data/lib/selenium/webdriver/{android.rb → common/interactions/none_input.rb} +14 -6
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
- data/lib/selenium/webdriver/common/keyboard.rb +10 -14
- data/lib/selenium/webdriver/common/keys.rb +102 -82
- data/lib/selenium/webdriver/common/log_entry.rb +7 -8
- data/lib/selenium/webdriver/common/logger.rb +115 -0
- data/lib/selenium/webdriver/common/logs.rb +4 -6
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/mouse.rb +12 -14
- data/lib/selenium/webdriver/common/navigation.rb +4 -6
- data/lib/selenium/webdriver/common/options.rb +26 -127
- data/lib/selenium/webdriver/common/platform.rb +75 -101
- data/lib/selenium/webdriver/common/port_prober.rb +7 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +8 -11
- data/lib/selenium/webdriver/common/proxy.rb +68 -74
- data/lib/selenium/webdriver/common/search_context.rb +28 -37
- data/lib/selenium/webdriver/common/service.rb +219 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +15 -16
- data/lib/selenium/webdriver/common/socket_poller.rb +30 -28
- data/lib/selenium/webdriver/common/target_locator.rb +16 -18
- data/lib/selenium/webdriver/common/timeouts.rb +6 -8
- data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -10
- data/lib/selenium/webdriver/common/touch_screen.rb +22 -23
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +212 -0
- data/lib/selenium/webdriver/common/w3c_manager.rb +45 -0
- data/lib/selenium/webdriver/common/wait.rb +17 -16
- data/lib/selenium/webdriver/common/window.rb +50 -17
- data/lib/selenium/webdriver/common/zipper.rb +9 -13
- data/lib/selenium/webdriver/common.rb +21 -7
- data/lib/selenium/webdriver/edge/bridge.rb +34 -63
- data/lib/selenium/webdriver/edge/driver.rb +66 -0
- data/lib/selenium/webdriver/edge/options.rb +80 -0
- data/lib/selenium/webdriver/edge/service.rb +23 -95
- data/lib/selenium/webdriver/edge.rb +13 -13
- data/lib/selenium/webdriver/firefox/binary.rb +45 -60
- data/lib/selenium/webdriver/firefox/driver.rb +50 -0
- data/lib/selenium/webdriver/firefox/extension/prefs.json +3 -12
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/extension.rb +20 -10
- data/lib/selenium/webdriver/firefox/launcher.rb +16 -22
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +83 -0
- data/lib/selenium/webdriver/firefox/marionette/bridge.rb +49 -0
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +90 -0
- data/lib/selenium/webdriver/firefox/options.rb +162 -0
- data/lib/selenium/webdriver/firefox/profile.rb +47 -48
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +11 -18
- data/lib/selenium/webdriver/firefox/service.rb +24 -95
- data/lib/selenium/webdriver/firefox/util.rb +2 -4
- data/lib/selenium/webdriver/firefox.rb +27 -12
- data/lib/selenium/webdriver/ie/driver.rb +85 -0
- data/lib/selenium/webdriver/ie/options.rb +138 -0
- data/lib/selenium/webdriver/ie/service.rb +54 -0
- data/lib/selenium/webdriver/ie.rb +12 -10
- data/lib/selenium/webdriver/remote/bridge.rb +100 -564
- data/lib/selenium/webdriver/remote/capabilities.rb +98 -100
- data/lib/selenium/webdriver/remote/driver.rb +51 -0
- data/lib/selenium/webdriver/remote/http/common.rb +34 -22
- data/lib/selenium/webdriver/remote/http/curb.rb +13 -14
- data/lib/selenium/webdriver/remote/http/default.rb +62 -43
- data/lib/selenium/webdriver/remote/http/persistent.rb +12 -9
- data/lib/selenium/webdriver/remote/oss/bridge.rb +594 -0
- data/lib/selenium/webdriver/remote/oss/commands.rb +223 -0
- data/lib/selenium/webdriver/remote/response.rb +48 -28
- data/lib/selenium/webdriver/remote/server_error.rb +3 -5
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +605 -0
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +310 -0
- data/lib/selenium/webdriver/remote/w3c/commands.rb +157 -0
- data/lib/selenium/webdriver/remote.rb +10 -16
- data/lib/selenium/webdriver/safari/bridge.rb +17 -101
- data/lib/selenium/webdriver/{firefox/w3c_bridge.rb → safari/driver.rb} +27 -25
- data/lib/selenium/webdriver/safari/options.rb +29 -31
- data/lib/selenium/webdriver/safari/service.rb +38 -0
- data/lib/selenium/webdriver/safari.rb +27 -27
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +19 -4
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -5
- data/lib/selenium/webdriver/support/color.rb +60 -43
- data/lib/selenium/webdriver/support/escaper.rb +43 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +39 -41
- data/lib/selenium/webdriver/support/select.rb +45 -97
- data/lib/selenium/webdriver/support.rb +3 -2
- data/lib/selenium/webdriver/{iphone.rb → version.rb} +3 -7
- data/lib/selenium/webdriver.rb +36 -23
- data/lib/selenium-webdriver.rb +2 -2
- data/selenium-webdriver.gemspec +42 -29
- metadata +331 -262
- data/lib/selenium/client/base.rb +0 -151
- data/lib/selenium/client/driver.rb +0 -29
- data/lib/selenium/client/errors.rb +0 -28
- data/lib/selenium/client/extensions.rb +0 -132
- data/lib/selenium/client/idiomatic.rb +0 -507
- data/lib/selenium/client/javascript_expression_builder.rb +0 -135
- data/lib/selenium/client/javascript_frameworks/jquery.rb +0 -32
- data/lib/selenium/client/javascript_frameworks/prototype.rb +0 -32
- data/lib/selenium/client/legacy_driver.rb +0 -1722
- data/lib/selenium/client/protocol.rb +0 -123
- data/lib/selenium/client/selenium_helper.rb +0 -49
- data/lib/selenium/client.rb +0 -57
- data/lib/selenium/rake/server_task.rb +0 -176
- data/lib/selenium/webdriver/android/bridge.rb +0 -68
- data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
- data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
- data/lib/selenium/webdriver/common/html5/location.rb +0 -19
- data/lib/selenium/webdriver/common/w3c_error.rb +0 -194
- data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
- data/lib/selenium/webdriver/firefox/bridge.rb +0 -89
- data/lib/selenium/webdriver/ie/bridge.rb +0 -88
- data/lib/selenium/webdriver/ie/server.rb +0 -133
- data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
- data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -78
- data/lib/selenium/webdriver/phantomjs/service.rb +0 -130
- data/lib/selenium/webdriver/remote/commands.rb +0 -211
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -668
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -236
- data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -132
- data/lib/selenium/webdriver/safari/resources/client.js +0 -7255
- data/lib/selenium/webdriver/safari/server.rb +0 -187
- data/lib/selenium-client.rb +0 -21
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
4
|
# or more contributor license agreements. See the NOTICE file
|
5
5
|
# distributed with this work for additional information
|
@@ -19,120 +19,146 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
module Error
|
22
|
+
module Error # rubocop:disable Metrics/ModuleLength
|
23
|
+
|
24
|
+
#
|
25
|
+
# Returns exception from code (Integer - OSS, String - W3C).
|
26
|
+
# @param [Integer, String, nil] code
|
27
|
+
#
|
28
|
+
|
29
|
+
def self.for_code(code)
|
30
|
+
case code
|
31
|
+
when nil, 0
|
32
|
+
nil
|
33
|
+
when Integer
|
34
|
+
Object.const_get(ERRORS.fetch(code).to_s)
|
35
|
+
when String
|
36
|
+
klass_name = code.split(' ').map(&:capitalize).join.sub(/Error$/, '')
|
37
|
+
const_get("#{klass_name}Error", false)
|
38
|
+
end
|
39
|
+
rescue KeyError, NameError
|
40
|
+
WebDriverError
|
41
|
+
end
|
23
42
|
|
24
43
|
class WebDriverError < StandardError; end
|
25
|
-
class UnsupportedOperationError < WebDriverError; end
|
26
44
|
|
27
|
-
class IndexOutOfBoundsError < WebDriverError; end
|
28
|
-
class NoCollectionError < WebDriverError; end
|
29
|
-
class NoStringError < WebDriverError; end
|
30
|
-
class NoStringLengthError < WebDriverError; end
|
31
|
-
class NoStringWrapperError < WebDriverError; end
|
32
|
-
class NoSuchDriverError < WebDriverError; end
|
45
|
+
class IndexOutOfBoundsError < WebDriverError; end # 1
|
46
|
+
class NoCollectionError < WebDriverError; end # 2
|
47
|
+
class NoStringError < WebDriverError; end # 3
|
48
|
+
class NoStringLengthError < WebDriverError; end # 4
|
49
|
+
class NoStringWrapperError < WebDriverError; end # 5
|
50
|
+
class NoSuchDriverError < WebDriverError; end # 6
|
33
51
|
|
34
52
|
#
|
35
|
-
# An element could not be located on the page using the given search
|
36
|
-
# parameters.
|
53
|
+
# An element could not be located on the page using the given search parameters.
|
37
54
|
#
|
38
55
|
|
39
|
-
class NoSuchElementError < WebDriverError; end
|
56
|
+
class NoSuchElementError < WebDriverError; end # 7
|
40
57
|
|
41
58
|
#
|
42
|
-
# A
|
43
|
-
# frame could not be found.
|
59
|
+
# A command to switch to a frame could not be satisfied because the frame could not be found.
|
44
60
|
#
|
45
61
|
|
46
|
-
class NoSuchFrameError < WebDriverError; end
|
47
|
-
class UnknownCommandError < WebDriverError; end # 9
|
62
|
+
class NoSuchFrameError < WebDriverError; end # 8
|
48
63
|
|
64
|
+
#
|
65
|
+
# A command could not be executed because the remote end is not aware of it.
|
66
|
+
#
|
67
|
+
|
68
|
+
class UnknownCommandError < WebDriverError; end # 9
|
49
69
|
|
50
70
|
#
|
51
|
-
#
|
52
|
-
# no longer appears in the DOM of the page.
|
71
|
+
# A command failed because the referenced element is no longer attached to the DOM.
|
53
72
|
#
|
54
73
|
|
55
|
-
class StaleElementReferenceError < WebDriverError; end
|
74
|
+
class StaleElementReferenceError < WebDriverError; end # 10
|
56
75
|
|
57
76
|
#
|
58
|
-
# Raised to indicate that although an element is present on the DOM,
|
59
|
-
#
|
77
|
+
# Raised to indicate that although an element is present on the DOM, it is not visible, and
|
78
|
+
# so is not able to be interacted with.
|
60
79
|
#
|
61
80
|
|
62
|
-
class ElementNotVisibleError < WebDriverError; end
|
81
|
+
class ElementNotVisibleError < WebDriverError; end # 11
|
63
82
|
|
64
83
|
#
|
65
|
-
#
|
66
|
-
#
|
84
|
+
# The target element is in an invalid state, rendering it impossible to interact with, for
|
85
|
+
# example if you click a disabled element.
|
67
86
|
#
|
68
87
|
|
69
|
-
class InvalidElementStateError < WebDriverError; end
|
88
|
+
class InvalidElementStateError < WebDriverError; end # 12
|
70
89
|
|
71
90
|
#
|
72
|
-
# An unknown
|
91
|
+
# An unknown error occurred in the remote end while processing the command.
|
73
92
|
#
|
74
93
|
|
75
|
-
class UnknownError < WebDriverError; end
|
76
|
-
class ExpectedError < WebDriverError; end
|
94
|
+
class UnknownError < WebDriverError; end # 13
|
95
|
+
class ExpectedError < WebDriverError; end # 14
|
77
96
|
|
78
97
|
#
|
79
98
|
# An attempt was made to select an element that cannot be selected.
|
80
99
|
#
|
81
100
|
|
82
|
-
class ElementNotSelectableError < WebDriverError; end
|
83
|
-
class NoSuchDocumentError < WebDriverError; end
|
101
|
+
class ElementNotSelectableError < WebDriverError; end # 15
|
102
|
+
class NoSuchDocumentError < WebDriverError; end # 16
|
84
103
|
|
85
104
|
#
|
86
|
-
# An error occurred while executing
|
105
|
+
# An error occurred while executing JavaScript supplied by the user.
|
87
106
|
#
|
88
107
|
|
89
|
-
class JavascriptError < WebDriverError; end
|
90
|
-
class NoScriptResultError < WebDriverError; end
|
108
|
+
class JavascriptError < WebDriverError; end # 17
|
109
|
+
class NoScriptResultError < WebDriverError; end # 18
|
91
110
|
|
92
111
|
#
|
93
112
|
# An error occurred while searching for an element by XPath.
|
94
113
|
#
|
95
114
|
|
96
|
-
class XPathLookupError < WebDriverError; end
|
97
|
-
class NoSuchCollectionError < WebDriverError; end
|
115
|
+
class XPathLookupError < WebDriverError; end # 19
|
116
|
+
class NoSuchCollectionError < WebDriverError; end # 20
|
98
117
|
|
99
118
|
#
|
100
|
-
#
|
119
|
+
# An operation did not complete before its timeout expired.
|
101
120
|
#
|
102
121
|
|
103
|
-
class TimeOutError < WebDriverError; end
|
104
|
-
|
105
|
-
class
|
122
|
+
class TimeOutError < WebDriverError; end # 21
|
123
|
+
|
124
|
+
class NullPointerError < WebDriverError; end # 22
|
125
|
+
class NoSuchWindowError < WebDriverError; end # 23
|
106
126
|
|
107
127
|
#
|
108
|
-
#
|
109
|
-
# the current URL.
|
128
|
+
# An illegal attempt was made to set a cookie under a different domain than the current page.
|
110
129
|
#
|
111
130
|
|
112
|
-
class InvalidCookieDomainError < WebDriverError; end
|
131
|
+
class InvalidCookieDomainError < WebDriverError; end # 24
|
113
132
|
|
114
133
|
#
|
115
|
-
#
|
134
|
+
# A command to set a cookie's value could not be satisfied.
|
116
135
|
#
|
117
136
|
|
118
|
-
class UnableToSetCookieError < WebDriverError; end
|
137
|
+
class UnableToSetCookieError < WebDriverError; end # 25
|
119
138
|
|
120
139
|
#
|
121
140
|
# Raised when an alert dialog is present that has not been dealt with.
|
122
141
|
#
|
123
|
-
class UnhandledAlertError < WebDriverError; end
|
142
|
+
class UnhandledAlertError < WebDriverError; end # 26
|
124
143
|
|
125
144
|
#
|
126
|
-
#
|
145
|
+
# An attempt was made to operate on a modal dialog when one was not open:
|
146
|
+
#
|
147
|
+
# * W3C dialect is NoSuchAlertError
|
148
|
+
# * OSS dialect is NoAlertPresentError
|
149
|
+
#
|
150
|
+
# We want to allow clients to rescue NoSuchAlertError as a superclass for
|
151
|
+
# dialect-agnostic implementation, so NoAlertPresentError should inherit from it.
|
127
152
|
#
|
128
153
|
|
129
|
-
class
|
154
|
+
class NoSuchAlertError < WebDriverError; end
|
155
|
+
class NoAlertPresentError < NoSuchAlertError; end # 27
|
130
156
|
|
131
157
|
#
|
132
158
|
# A script did not complete before its timeout expired.
|
133
159
|
#
|
134
160
|
|
135
|
-
class ScriptTimeOutError < WebDriverError; end
|
161
|
+
class ScriptTimeOutError < WebDriverError; end # 28
|
136
162
|
|
137
163
|
#
|
138
164
|
# The coordinates provided to an interactions operation are invalid.
|
@@ -141,12 +167,11 @@ module Selenium
|
|
141
167
|
class InvalidElementCoordinatesError < WebDriverError; end # 29
|
142
168
|
|
143
169
|
#
|
144
|
-
# Indicates that IME support is not available. This exception is rasied
|
145
|
-
#
|
146
|
-
# the machine.
|
170
|
+
# Indicates that IME support is not available. This exception is rasied for every IME-related
|
171
|
+
# method call if IME support is not available on the machine.
|
147
172
|
#
|
148
173
|
|
149
|
-
class IMENotAvailableError < WebDriverError; end
|
174
|
+
class IMENotAvailableError < WebDriverError; end # 30
|
150
175
|
|
151
176
|
#
|
152
177
|
# Indicates that activating an IME engine has failed.
|
@@ -155,70 +180,200 @@ module Selenium
|
|
155
180
|
class IMEEngineActivationFailedError < WebDriverError; end # 31
|
156
181
|
|
157
182
|
#
|
158
|
-
# Argument was an invalid selector
|
183
|
+
# Argument was an invalid selector.
|
159
184
|
#
|
160
185
|
|
161
|
-
class InvalidSelectorError < WebDriverError; end
|
186
|
+
class InvalidSelectorError < WebDriverError; end # 32
|
162
187
|
|
163
188
|
#
|
164
189
|
# A new session could not be created.
|
165
190
|
#
|
166
191
|
|
167
|
-
class SessionNotCreatedError < WebDriverError; end
|
192
|
+
class SessionNotCreatedError < WebDriverError; end # 33
|
193
|
+
|
194
|
+
#
|
195
|
+
# The target for mouse interaction is not in the browser's viewport and cannot be brought
|
196
|
+
# into that viewport.
|
197
|
+
#
|
198
|
+
|
199
|
+
class MoveTargetOutOfBoundsError < WebDriverError; end # 34
|
168
200
|
|
169
201
|
#
|
170
|
-
# Indicates that the
|
171
|
-
# invalid, e.g. outside of the bounds of the window.
|
202
|
+
# Indicates that the XPath selector is invalid
|
172
203
|
#
|
173
204
|
|
174
|
-
class
|
205
|
+
class InvalidXpathSelectorError < WebDriverError; end
|
206
|
+
class InvalidXpathSelectorReturnTyperError < WebDriverError; end
|
207
|
+
|
208
|
+
#
|
209
|
+
# A command could not be completed because the element is not pointer or keyboard
|
210
|
+
# interactable.
|
211
|
+
#
|
212
|
+
|
213
|
+
class ElementNotInteractableError < WebDriverError; end
|
214
|
+
|
215
|
+
#
|
216
|
+
# A command could not be completed because TLS certificate is expired
|
217
|
+
# or invalid.
|
218
|
+
#
|
219
|
+
|
220
|
+
class InsecureCertificateError < WebDriverError; end
|
221
|
+
|
222
|
+
#
|
223
|
+
# The arguments passed to a command are either invalid or malformed.
|
224
|
+
#
|
225
|
+
|
226
|
+
class InvalidArgumentError < WebDriverError; end
|
227
|
+
|
228
|
+
#
|
229
|
+
# No cookie matching the given path name was found amongst the associated cookies of the
|
230
|
+
# current browsing context's active document.
|
231
|
+
#
|
175
232
|
|
233
|
+
class NoSuchCookieError < WebDriverError; end
|
234
|
+
|
235
|
+
#
|
236
|
+
# A screen capture was made impossible.
|
237
|
+
#
|
238
|
+
|
239
|
+
class UnableToCaptureScreenError < WebDriverError; end
|
240
|
+
|
241
|
+
#
|
242
|
+
# Occurs if the given session id is not in the list of active sessions, meaning the session
|
243
|
+
# either does not exist or that it's not active.
|
244
|
+
#
|
245
|
+
|
246
|
+
class InvalidSessionIdError < WebDriverError; end
|
247
|
+
|
248
|
+
#
|
249
|
+
# A modal dialog was open, blocking this operation.
|
250
|
+
#
|
251
|
+
|
252
|
+
class UnexpectedAlertOpenError < WebDriverError; end
|
253
|
+
|
254
|
+
#
|
255
|
+
# The requested command matched a known URL but did not match an method for that URL.
|
256
|
+
#
|
257
|
+
|
258
|
+
class UnknownMethodError < WebDriverError; end
|
259
|
+
|
260
|
+
#
|
261
|
+
# The Element Click command could not be completed because the element receiving the events
|
262
|
+
# is obscuring the element that was requested clicked.
|
263
|
+
#
|
264
|
+
|
265
|
+
class ElementClickInterceptedError < WebDriverError; end
|
266
|
+
|
267
|
+
#
|
268
|
+
# Indicates that a command that should have executed properly cannot be supported for some
|
269
|
+
# reason.
|
270
|
+
#
|
271
|
+
|
272
|
+
class UnsupportedOperationError < WebDriverError; end
|
273
|
+
|
274
|
+
# Aliases for OSS dialect.
|
275
|
+
ScriptTimeoutError = Class.new(ScriptTimeOutError)
|
276
|
+
TimeoutError = Class.new(TimeOutError)
|
277
|
+
NoAlertOpenError = Class.new(NoAlertPresentError)
|
278
|
+
|
279
|
+
# Aliases for backwards compatibility.
|
280
|
+
ObsoleteElementError = Class.new(StaleElementReferenceError)
|
281
|
+
UnhandledError = Class.new(UnknownError)
|
282
|
+
UnexpectedJavascriptError = Class.new(JavascriptError)
|
283
|
+
ElementNotDisplayedError = Class.new(ElementNotVisibleError)
|
284
|
+
|
285
|
+
#
|
176
286
|
# @api private
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
287
|
+
#
|
288
|
+
|
289
|
+
ERRORS = {
|
290
|
+
1 => IndexOutOfBoundsError,
|
291
|
+
2 => NoCollectionError,
|
292
|
+
3 => NoStringError,
|
293
|
+
4 => NoStringLengthError,
|
294
|
+
5 => NoStringWrapperError,
|
295
|
+
6 => NoSuchDriverError,
|
296
|
+
7 => NoSuchElementError,
|
297
|
+
8 => NoSuchFrameError,
|
298
|
+
9 => UnknownCommandError,
|
299
|
+
10 => StaleElementReferenceError,
|
300
|
+
11 => ElementNotVisibleError,
|
301
|
+
12 => InvalidElementStateError,
|
302
|
+
13 => UnknownError,
|
303
|
+
14 => ExpectedError,
|
304
|
+
15 => ElementNotSelectableError,
|
305
|
+
16 => NoSuchDocumentError,
|
306
|
+
17 => JavascriptError,
|
307
|
+
18 => NoScriptResultError,
|
308
|
+
19 => XPathLookupError,
|
309
|
+
20 => NoSuchCollectionError,
|
310
|
+
21 => TimeOutError,
|
311
|
+
22 => NullPointerError,
|
312
|
+
23 => NoSuchWindowError,
|
313
|
+
24 => InvalidCookieDomainError,
|
314
|
+
25 => UnableToSetCookieError,
|
315
|
+
26 => UnhandledAlertError,
|
316
|
+
27 => NoAlertPresentError,
|
317
|
+
28 => ScriptTimeOutError,
|
318
|
+
29 => InvalidElementCoordinatesError,
|
319
|
+
30 => IMENotAvailableError,
|
320
|
+
31 => IMEEngineActivationFailedError,
|
321
|
+
32 => InvalidSelectorError,
|
322
|
+
33 => SessionNotCreatedError,
|
323
|
+
34 => MoveTargetOutOfBoundsError,
|
324
|
+
# The following are W3C-specific errors,
|
325
|
+
# they don't really need error codes, we just make them up!
|
326
|
+
51 => InvalidXpathSelectorError,
|
327
|
+
52 => InvalidXpathSelectorReturnTyperError,
|
328
|
+
60 => ElementNotInteractableError,
|
329
|
+
61 => InvalidArgumentError,
|
330
|
+
62 => NoSuchCookieError,
|
331
|
+
63 => UnableToCaptureScreenError
|
332
|
+
}.freeze
|
333
|
+
|
334
|
+
DEPRECATED_ERRORS = {
|
335
|
+
IndexOutOfBoundsError: nil,
|
336
|
+
NoCollectionError: nil,
|
337
|
+
NoStringError: nil,
|
338
|
+
NoStringLengthError: nil,
|
339
|
+
NoStringWrapperError: nil,
|
340
|
+
NoSuchDriverError: nil,
|
341
|
+
ElementNotVisibleError: ElementNotInteractableError,
|
342
|
+
InvalidElementStateError: ElementNotInteractableError,
|
343
|
+
ElementNotSelectableError: ElementNotInteractableError,
|
344
|
+
ExpectedError: nil,
|
345
|
+
NoSuchDocumentError: nil,
|
346
|
+
NoScriptResultError: nil,
|
347
|
+
XPathLookupError: InvalidSelectorError,
|
348
|
+
NoSuchCollectionError: nil,
|
349
|
+
UnhandledAlertError: UnexpectedAlertOpenError,
|
350
|
+
NoAlertPresentError: NoSuchAlertError,
|
351
|
+
NoAlertOpenError: NoSuchAlertError,
|
352
|
+
ScriptTimeOutError: ScriptTimeoutError,
|
353
|
+
InvalidElementCoordinatesError: nil,
|
354
|
+
IMENotAvailableError: nil,
|
355
|
+
IMEEngineActivationFailedError: nil,
|
356
|
+
InvalidXpathSelectorError: InvalidSelectorError,
|
357
|
+
InvalidXpathSelectorReturnTyperError: InvalidSelectorError,
|
358
|
+
TimeOutError: TimeoutError,
|
359
|
+
ObsoleteElementError: StaleElementReferenceError,
|
360
|
+
UnhandledError: UnknownError,
|
361
|
+
UnexpectedJavascriptError: JavascriptError,
|
362
|
+
ElementNotDisplayedError: ElementNotInteractableError
|
363
|
+
}.freeze
|
364
|
+
|
365
|
+
DEPRECATED_ERRORS.keys.each do |oss_error|
|
366
|
+
remove_const oss_error
|
367
|
+
end
|
368
|
+
|
369
|
+
def self.const_missing(const_name)
|
370
|
+
super unless DEPRECATED_ERRORS.key?(const_name)
|
371
|
+
if DEPRECATED_ERRORS[const_name]
|
372
|
+
WebDriver.logger.deprecate("Selenium::WebDriver::Error::#{const_name}",
|
373
|
+
"#{DEPRECATED_ERRORS[const_name]} (ensure the driver supports W3C WebDriver specification)")
|
374
|
+
DEPRECATED_ERRORS[const_name]
|
375
|
+
else
|
376
|
+
WebDriver.logger.deprecate("Selenium::WebDriver::Error::#{const_name}")
|
222
377
|
WebDriverError
|
223
378
|
end
|
224
379
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
4
|
# or more contributor license agreements. See the NOTICE file
|
5
5
|
# distributed with this work for additional information
|
@@ -19,21 +19,16 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api private
|
25
24
|
#
|
26
25
|
|
27
26
|
module FileReaper
|
28
|
-
|
29
27
|
class << self
|
30
|
-
|
31
|
-
@reap = bool
|
32
|
-
end
|
28
|
+
attr_writer :reap
|
33
29
|
|
34
30
|
def reap?
|
35
|
-
@reap =
|
36
|
-
!!@reap
|
31
|
+
@reap = defined?(@reap) ? @reap : true
|
37
32
|
end
|
38
33
|
|
39
34
|
def tmp_files
|
@@ -48,9 +43,7 @@ module Selenium
|
|
48
43
|
def reap(file)
|
49
44
|
return unless reap?
|
50
45
|
|
51
|
-
unless tmp_files.include?(file)
|
52
|
-
raise Error::WebDriverError, "file not added for reaping: #{file.inspect}"
|
53
|
-
end
|
46
|
+
raise Error::WebDriverError, "file not added for reaping: #{file.inspect}" unless tmp_files.include?(file)
|
54
47
|
|
55
48
|
FileUtils.rm_rf tmp_files.delete(file)
|
56
49
|
end
|
@@ -67,7 +60,6 @@ module Selenium
|
|
67
60
|
|
68
61
|
# we *do* want child process reaping, so not using Platform.exit_hook here.
|
69
62
|
at_exit { reap! }
|
70
|
-
|
71
63
|
end # FileReaper
|
72
64
|
end # WebDriver
|
73
|
-
end # Selenium
|
65
|
+
end # Selenium
|
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
4
|
# or more contributor license agreements. See the NOTICE file
|
5
5
|
# distributed with this work for additional information
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module HTML5
|
23
|
-
|
24
23
|
class LocalStorage
|
25
24
|
include SharedWebStorage
|
26
25
|
|
@@ -32,29 +31,28 @@ module Selenium
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def [](key)
|
35
|
-
@bridge.
|
34
|
+
@bridge.local_storage_item key
|
36
35
|
end
|
37
36
|
|
38
37
|
def []=(key, value)
|
39
|
-
@bridge.
|
38
|
+
@bridge.local_storage_item key, value
|
40
39
|
end
|
41
40
|
|
42
41
|
def delete(key)
|
43
|
-
@bridge.
|
42
|
+
@bridge.remove_local_storage_item key
|
44
43
|
end
|
45
44
|
|
46
45
|
def clear
|
47
|
-
@bridge.
|
46
|
+
@bridge.clear_local_storage
|
48
47
|
end
|
49
48
|
|
50
49
|
def size
|
51
|
-
@bridge.
|
50
|
+
@bridge.local_storage_size
|
52
51
|
end
|
53
52
|
|
54
53
|
def keys
|
55
|
-
@bridge.
|
54
|
+
@bridge.local_storage_keys.reverse
|
56
55
|
end
|
57
|
-
|
58
56
|
end # LocalStorage
|
59
57
|
end # HTML5
|
60
58
|
end # WebDriver
|
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
4
|
# or more contributor license agreements. See the NOTICE file
|
5
5
|
# distributed with this work for additional information
|
@@ -20,33 +20,32 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module HTML5
|
23
|
-
|
24
23
|
class SessionStorage
|
25
24
|
include Enumerable
|
26
25
|
include SharedWebStorage
|
27
26
|
|
28
27
|
def [](key)
|
29
|
-
@bridge.
|
28
|
+
@bridge.session_storage_item key
|
30
29
|
end
|
31
30
|
|
32
31
|
def []=(key, value)
|
33
|
-
@bridge.
|
32
|
+
@bridge.session_storage_item key, value
|
34
33
|
end
|
35
34
|
|
36
35
|
def delete(key)
|
37
|
-
@bridge.
|
36
|
+
@bridge.remove_session_storage_item key
|
38
37
|
end
|
39
38
|
|
40
39
|
def clear
|
41
|
-
@bridge.
|
40
|
+
@bridge.clear_session_storage
|
42
41
|
end
|
43
42
|
|
44
43
|
def size
|
45
|
-
@bridge.
|
44
|
+
@bridge.session_storage_size
|
46
45
|
end
|
47
46
|
|
48
47
|
def keys
|
49
|
-
@bridge.
|
48
|
+
@bridge.session_storage_keys.reverse
|
50
49
|
end
|
51
50
|
|
52
51
|
#
|
@@ -56,7 +55,6 @@ module Selenium
|
|
56
55
|
def initialize(bridge)
|
57
56
|
@bridge = bridge
|
58
57
|
end
|
59
|
-
|
60
58
|
end # SessionStorage
|
61
59
|
end # HTML5
|
62
60
|
end # WebDriver
|
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
4
|
# or more contributor license agreements. See the NOTICE file
|
5
5
|
# distributed with this work for additional information
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module HTML5
|
23
|
-
|
24
23
|
module SharedWebStorage
|
25
24
|
include Enumerable
|
26
25
|
|
@@ -30,31 +29,24 @@ module Selenium
|
|
30
29
|
alias_method :member?, :key?
|
31
30
|
alias_method :has_key?, :key?
|
32
31
|
|
33
|
-
def fetch(key
|
34
|
-
|
35
|
-
|
36
|
-
end
|
32
|
+
def fetch(key)
|
33
|
+
return self[key] if key? key
|
34
|
+
return yield(key) if block_given?
|
37
35
|
|
38
|
-
|
39
|
-
yield key
|
40
|
-
else
|
41
|
-
# should be KeyError, but it's 1.9-specific
|
42
|
-
raise IndexError, "missing key #{key.inspect}"
|
43
|
-
end
|
36
|
+
raise KeyError, "missing key #{key.inspect}"
|
44
37
|
end
|
45
38
|
|
46
39
|
def empty?
|
47
|
-
|
40
|
+
to_a.empty?
|
48
41
|
end
|
49
42
|
|
50
|
-
def each
|
43
|
+
def each
|
51
44
|
return enum_for(:each) unless block_given?
|
52
45
|
|
53
46
|
keys.each do |k|
|
54
47
|
yield k, self[k]
|
55
48
|
end
|
56
49
|
end
|
57
|
-
|
58
50
|
end # SharedWebStorage
|
59
51
|
end # HTML5
|
60
52
|
end # WebDriver
|