selenium-webdriver 2.45.0 → 3.142.7
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 +7 -0
- data/CHANGES +795 -3
- data/Gemfile +2 -0
- data/{COPYING → LICENSE} +1 -3
- data/README.md +13 -9
- data/lib/selenium/server.rb +93 -71
- data/lib/selenium/webdriver/atoms/getAttribute.js +7 -0
- data/lib/selenium/webdriver/atoms/isDisplayed.js +102 -0
- data/lib/selenium/webdriver/atoms.rb +37 -0
- data/lib/selenium/webdriver/chrome/bridge.rb +47 -99
- 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 +40 -20
- data/lib/selenium/webdriver/chrome/service.rb +46 -62
- data/lib/selenium/webdriver/chrome.rb +34 -6
- data/lib/selenium/webdriver/common/action_builder.rb +69 -56
- data/lib/selenium/webdriver/common/alert.rb +25 -8
- data/lib/selenium/webdriver/common/bridge_helper.rb +35 -20
- data/lib/selenium/webdriver/common/driver.rb +90 -63
- 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_debugger.rb +42 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +26 -11
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +58 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +23 -6
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +19 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +24 -7
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +19 -3
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +23 -7
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +26 -5
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +20 -6
- data/lib/selenium/webdriver/common/element.rb +79 -37
- data/lib/selenium/webdriver/common/error.rb +282 -106
- data/lib/selenium/webdriver/common/file_reaper.rb +23 -12
- data/lib/selenium/webdriver/common/html5/local_storage.rb +29 -12
- data/lib/selenium/webdriver/common/html5/session_storage.rb +29 -12
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +29 -18
- 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/common/interactions/interactions.rb +43 -0
- 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/common/interactions/none_input.rb +36 -0
- 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 +27 -12
- data/lib/selenium/webdriver/common/keys.rb +118 -81
- data/lib/selenium/webdriver/common/log_entry.rb +27 -8
- data/lib/selenium/webdriver/common/logger.rb +115 -0
- data/lib/selenium/webdriver/common/logs.rb +24 -7
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/mouse.rb +29 -12
- data/lib/selenium/webdriver/common/navigation.rb +21 -4
- data/lib/selenium/webdriver/common/options.rb +43 -126
- data/lib/selenium/webdriver/common/platform.rb +101 -97
- data/lib/selenium/webdriver/common/port_prober.rb +24 -17
- data/lib/selenium/webdriver/common/profile_helper.rb +27 -11
- data/lib/selenium/webdriver/common/proxy.rb +86 -73
- data/lib/selenium/webdriver/common/search_context.rb +49 -33
- data/lib/selenium/webdriver/common/service.rb +219 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +82 -0
- data/lib/selenium/webdriver/common/socket_poller.rb +47 -26
- data/lib/selenium/webdriver/common/target_locator.rb +35 -14
- data/lib/selenium/webdriver/common/timeouts.rb +23 -6
- data/lib/selenium/webdriver/common/touch_action_builder.rb +25 -11
- data/lib/selenium/webdriver/common/touch_screen.rb +42 -24
- 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 +34 -14
- data/lib/selenium/webdriver/common/window.rb +75 -16
- data/lib/selenium/webdriver/common/zipper.rb +26 -11
- data/lib/selenium/webdriver/common.rb +40 -7
- data/lib/selenium/webdriver/edge/bridge.rb +76 -0
- 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 +52 -0
- data/lib/selenium/webdriver/edge.rb +44 -0
- data/lib/selenium/webdriver/firefox/binary.rb +70 -48
- data/lib/selenium/webdriver/firefox/driver.rb +50 -0
- data/lib/selenium/webdriver/firefox/extension/prefs.json +14 -13
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/extension.rb +50 -19
- data/lib/selenium/webdriver/firefox/launcher.rb +33 -28
- 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 +66 -48
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +28 -16
- data/lib/selenium/webdriver/firefox/service.rb +52 -0
- data/lib/selenium/webdriver/firefox/util.rb +19 -2
- data/lib/selenium/webdriver/firefox.rb +46 -10
- 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 +32 -10
- data/lib/selenium/webdriver/remote/bridge.rb +117 -572
- data/lib/selenium/webdriver/remote/capabilities.rb +116 -99
- data/lib/selenium/webdriver/remote/driver.rb +51 -0
- data/lib/selenium/webdriver/remote/http/common.rb +54 -23
- data/lib/selenium/webdriver/remote/http/curb.rb +30 -12
- data/lib/selenium/webdriver/remote/http/default.rb +85 -42
- data/lib/selenium/webdriver/remote/http/persistent.rb +29 -7
- 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 +68 -30
- data/lib/selenium/webdriver/remote/server_error.rb +22 -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 +27 -13
- data/lib/selenium/webdriver/safari/bridge.rb +38 -107
- data/lib/selenium/webdriver/safari/driver.rb +68 -0
- data/lib/selenium/webdriver/safari/options.rb +56 -75
- data/lib/selenium/webdriver/safari/service.rb +38 -0
- data/lib/selenium/webdriver/safari.rb +49 -31
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +40 -6
- data/lib/selenium/webdriver/support/block_event_listener.rb +24 -7
- data/lib/selenium/webdriver/support/color.rb +82 -46
- data/lib/selenium/webdriver/support/escaper.rb +43 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +56 -39
- data/lib/selenium/webdriver/support/select.rb +66 -89
- data/lib/selenium/webdriver/support.rb +20 -0
- data/lib/selenium/webdriver/version.rb +24 -0
- data/lib/selenium/webdriver.rb +55 -25
- data/lib/selenium-webdriver.rb +19 -0
- data/selenium-webdriver.gemspec +42 -29
- metadata +331 -260
- data/Gemfile.lock +0 -48
- data/lib/selenium/client/base.rb +0 -132
- data/lib/selenium/client/driver.rb +0 -10
- data/lib/selenium/client/errors.rb +0 -9
- data/lib/selenium/client/extensions.rb +0 -118
- data/lib/selenium/client/idiomatic.rb +0 -488
- data/lib/selenium/client/javascript_expression_builder.rb +0 -116
- data/lib/selenium/client/javascript_frameworks/jquery.rb +0 -13
- data/lib/selenium/client/javascript_frameworks/prototype.rb +0 -13
- data/lib/selenium/client/legacy_driver.rb +0 -1720
- data/lib/selenium/client/protocol.rb +0 -104
- data/lib/selenium/client/selenium_helper.rb +0 -34
- data/lib/selenium/client.rb +0 -38
- data/lib/selenium/rake/server_task.rb +0 -157
- data/lib/selenium/webdriver/android/bridge.rb +0 -49
- data/lib/selenium/webdriver/android.rb +0 -9
- data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -9
- data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -42
- data/lib/selenium/webdriver/common/core_ext/string.rb +0 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_browser_connection.rb +0 -17
- data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +0 -39
- data/lib/selenium/webdriver/common/html5/location.rb +0 -0
- data/lib/selenium/webdriver/common/json_helper.rb +0 -34
- data/lib/selenium/webdriver/firefox/bridge.rb +0 -70
- data/lib/selenium/webdriver/firefox/socket_lock.rb +0 -61
- data/lib/selenium/webdriver/ie/bridge.rb +0 -69
- data/lib/selenium/webdriver/ie/server.rb +0 -90
- data/lib/selenium/webdriver/iphone/bridge.rb +0 -45
- data/lib/selenium/webdriver/iphone.rb +0 -9
- data/lib/selenium/webdriver/opera/bridge.rb +0 -112
- data/lib/selenium/webdriver/opera/service.rb +0 -49
- data/lib/selenium/webdriver/opera.rb +0 -24
- data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -59
- data/lib/selenium/webdriver/phantomjs/service.rb +0 -90
- data/lib/selenium/webdriver/phantomjs.rb +0 -22
- data/lib/selenium/webdriver/remote/commands.rb +0 -192
- data/lib/selenium/webdriver/safari/browser.rb +0 -20
- data/lib/selenium/webdriver/safari/extensions.rb +0 -170
- data/lib/selenium/webdriver/safari/resources/SafariDriver.safariextz +0 -0
- data/lib/selenium/webdriver/safari/resources/client.js +0 -6903
- data/lib/selenium/webdriver/safari/server.rb +0 -145
- data/lib/selenium-client.rb +0 -2
|
@@ -1,119 +1,164 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
|
|
1
20
|
module Selenium
|
|
2
21
|
module WebDriver
|
|
3
|
-
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
|
|
4
42
|
|
|
5
43
|
class WebDriverError < StandardError; end
|
|
6
|
-
class UnsupportedOperationError < WebDriverError; end
|
|
7
44
|
|
|
8
|
-
class IndexOutOfBoundsError < WebDriverError; end
|
|
9
|
-
class NoCollectionError < WebDriverError; end
|
|
10
|
-
class NoStringError < WebDriverError; end
|
|
11
|
-
class NoStringLengthError < WebDriverError; end
|
|
12
|
-
class NoStringWrapperError < WebDriverError; end
|
|
13
|
-
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
|
|
14
51
|
|
|
15
52
|
#
|
|
16
|
-
# An element could not be located on the page using the given search
|
|
17
|
-
# parameters.
|
|
53
|
+
# An element could not be located on the page using the given search parameters.
|
|
18
54
|
#
|
|
19
55
|
|
|
20
|
-
class NoSuchElementError < WebDriverError; end
|
|
56
|
+
class NoSuchElementError < WebDriverError; end # 7
|
|
21
57
|
|
|
22
58
|
#
|
|
23
|
-
# A
|
|
24
|
-
# frame could not be found.
|
|
59
|
+
# A command to switch to a frame could not be satisfied because the frame could not be found.
|
|
25
60
|
#
|
|
26
61
|
|
|
27
|
-
class NoSuchFrameError < WebDriverError; end
|
|
28
|
-
|
|
62
|
+
class NoSuchFrameError < WebDriverError; end # 8
|
|
63
|
+
|
|
64
|
+
#
|
|
65
|
+
# A command could not be executed because the remote end is not aware of it.
|
|
66
|
+
#
|
|
29
67
|
|
|
68
|
+
class UnknownCommandError < WebDriverError; end # 9
|
|
30
69
|
|
|
31
70
|
#
|
|
32
|
-
#
|
|
33
|
-
# no longer appears in the DOM of the page.
|
|
71
|
+
# A command failed because the referenced element is no longer attached to the DOM.
|
|
34
72
|
#
|
|
35
73
|
|
|
36
|
-
class StaleElementReferenceError < WebDriverError; end
|
|
74
|
+
class StaleElementReferenceError < WebDriverError; end # 10
|
|
37
75
|
|
|
38
76
|
#
|
|
39
|
-
# Raised to indicate that although an element is present on the DOM,
|
|
40
|
-
#
|
|
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.
|
|
41
79
|
#
|
|
42
80
|
|
|
43
|
-
class ElementNotVisibleError < WebDriverError; end
|
|
81
|
+
class ElementNotVisibleError < WebDriverError; end # 11
|
|
44
82
|
|
|
45
83
|
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
84
|
+
# The target element is in an invalid state, rendering it impossible to interact with, for
|
|
85
|
+
# example if you click a disabled element.
|
|
48
86
|
#
|
|
49
87
|
|
|
50
|
-
class InvalidElementStateError < WebDriverError; end
|
|
88
|
+
class InvalidElementStateError < WebDriverError; end # 12
|
|
51
89
|
|
|
52
90
|
#
|
|
53
|
-
# An unknown
|
|
91
|
+
# An unknown error occurred in the remote end while processing the command.
|
|
54
92
|
#
|
|
55
93
|
|
|
56
|
-
class UnknownError < WebDriverError; end
|
|
57
|
-
class ExpectedError < WebDriverError; end
|
|
94
|
+
class UnknownError < WebDriverError; end # 13
|
|
95
|
+
class ExpectedError < WebDriverError; end # 14
|
|
58
96
|
|
|
59
97
|
#
|
|
60
98
|
# An attempt was made to select an element that cannot be selected.
|
|
61
99
|
#
|
|
62
100
|
|
|
63
|
-
class ElementNotSelectableError < WebDriverError; end
|
|
64
|
-
class NoSuchDocumentError < WebDriverError; end
|
|
101
|
+
class ElementNotSelectableError < WebDriverError; end # 15
|
|
102
|
+
class NoSuchDocumentError < WebDriverError; end # 16
|
|
65
103
|
|
|
66
104
|
#
|
|
67
|
-
# An error occurred while executing
|
|
105
|
+
# An error occurred while executing JavaScript supplied by the user.
|
|
68
106
|
#
|
|
69
107
|
|
|
70
|
-
class JavascriptError < WebDriverError; end
|
|
71
|
-
class NoScriptResultError < WebDriverError; end
|
|
108
|
+
class JavascriptError < WebDriverError; end # 17
|
|
109
|
+
class NoScriptResultError < WebDriverError; end # 18
|
|
72
110
|
|
|
73
111
|
#
|
|
74
112
|
# An error occurred while searching for an element by XPath.
|
|
75
113
|
#
|
|
76
114
|
|
|
77
|
-
class XPathLookupError < WebDriverError; end
|
|
78
|
-
class NoSuchCollectionError < WebDriverError; end
|
|
115
|
+
class XPathLookupError < WebDriverError; end # 19
|
|
116
|
+
class NoSuchCollectionError < WebDriverError; end # 20
|
|
79
117
|
|
|
80
118
|
#
|
|
81
|
-
#
|
|
119
|
+
# An operation did not complete before its timeout expired.
|
|
82
120
|
#
|
|
83
121
|
|
|
84
|
-
class TimeOutError < WebDriverError; end
|
|
85
|
-
|
|
86
|
-
class
|
|
122
|
+
class TimeOutError < WebDriverError; end # 21
|
|
123
|
+
|
|
124
|
+
class NullPointerError < WebDriverError; end # 22
|
|
125
|
+
class NoSuchWindowError < WebDriverError; end # 23
|
|
87
126
|
|
|
88
127
|
#
|
|
89
|
-
#
|
|
90
|
-
# the current URL.
|
|
128
|
+
# An illegal attempt was made to set a cookie under a different domain than the current page.
|
|
91
129
|
#
|
|
92
130
|
|
|
93
|
-
class InvalidCookieDomainError < WebDriverError; end
|
|
131
|
+
class InvalidCookieDomainError < WebDriverError; end # 24
|
|
94
132
|
|
|
95
133
|
#
|
|
96
|
-
#
|
|
134
|
+
# A command to set a cookie's value could not be satisfied.
|
|
97
135
|
#
|
|
98
136
|
|
|
99
|
-
class UnableToSetCookieError < WebDriverError; end
|
|
137
|
+
class UnableToSetCookieError < WebDriverError; end # 25
|
|
100
138
|
|
|
101
139
|
#
|
|
102
140
|
# Raised when an alert dialog is present that has not been dealt with.
|
|
103
141
|
#
|
|
104
|
-
class UnhandledAlertError < WebDriverError; end
|
|
142
|
+
class UnhandledAlertError < WebDriverError; end # 26
|
|
105
143
|
|
|
106
144
|
#
|
|
107
|
-
#
|
|
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.
|
|
108
152
|
#
|
|
109
153
|
|
|
110
|
-
class
|
|
154
|
+
class NoSuchAlertError < WebDriverError; end
|
|
155
|
+
class NoAlertPresentError < NoSuchAlertError; end # 27
|
|
111
156
|
|
|
112
157
|
#
|
|
113
158
|
# A script did not complete before its timeout expired.
|
|
114
159
|
#
|
|
115
160
|
|
|
116
|
-
class ScriptTimeOutError < WebDriverError; end
|
|
161
|
+
class ScriptTimeOutError < WebDriverError; end # 28
|
|
117
162
|
|
|
118
163
|
#
|
|
119
164
|
# The coordinates provided to an interactions operation are invalid.
|
|
@@ -122,12 +167,11 @@ module Selenium
|
|
|
122
167
|
class InvalidElementCoordinatesError < WebDriverError; end # 29
|
|
123
168
|
|
|
124
169
|
#
|
|
125
|
-
# Indicates that IME support is not available. This exception is rasied
|
|
126
|
-
#
|
|
127
|
-
# 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.
|
|
128
172
|
#
|
|
129
173
|
|
|
130
|
-
class IMENotAvailableError < WebDriverError; end
|
|
174
|
+
class IMENotAvailableError < WebDriverError; end # 30
|
|
131
175
|
|
|
132
176
|
#
|
|
133
177
|
# Indicates that activating an IME engine has failed.
|
|
@@ -136,69 +180,201 @@ module Selenium
|
|
|
136
180
|
class IMEEngineActivationFailedError < WebDriverError; end # 31
|
|
137
181
|
|
|
138
182
|
#
|
|
139
|
-
# Argument was an invalid selector
|
|
183
|
+
# Argument was an invalid selector.
|
|
184
|
+
#
|
|
185
|
+
|
|
186
|
+
class InvalidSelectorError < WebDriverError; end # 32
|
|
187
|
+
|
|
188
|
+
#
|
|
189
|
+
# A new session could not be created.
|
|
190
|
+
#
|
|
191
|
+
|
|
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
|
|
200
|
+
|
|
201
|
+
#
|
|
202
|
+
# Indicates that the XPath selector is invalid
|
|
203
|
+
#
|
|
204
|
+
|
|
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
|
+
#
|
|
232
|
+
|
|
233
|
+
class NoSuchCookieError < WebDriverError; end
|
|
234
|
+
|
|
235
|
+
#
|
|
236
|
+
# A screen capture was made impossible.
|
|
140
237
|
#
|
|
141
238
|
|
|
142
|
-
class
|
|
143
|
-
# 33
|
|
239
|
+
class UnableToCaptureScreenError < WebDriverError; end
|
|
144
240
|
|
|
145
241
|
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
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.
|
|
148
244
|
#
|
|
149
245
|
|
|
150
|
-
class
|
|
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
|
+
#
|
|
151
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
|
+
#
|
|
152
286
|
# @api private
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
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}")
|
|
377
|
+
WebDriverError
|
|
202
378
|
end
|
|
203
379
|
end
|
|
204
380
|
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
|
|
1
20
|
module Selenium
|
|
2
21
|
module WebDriver
|
|
3
|
-
|
|
4
22
|
#
|
|
5
23
|
# @api private
|
|
6
24
|
#
|
|
7
25
|
|
|
8
26
|
module FileReaper
|
|
9
|
-
|
|
10
27
|
class << self
|
|
11
|
-
|
|
12
|
-
@reap = bool
|
|
13
|
-
end
|
|
28
|
+
attr_writer :reap
|
|
14
29
|
|
|
15
30
|
def reap?
|
|
16
|
-
@reap =
|
|
17
|
-
!!@reap
|
|
31
|
+
@reap = defined?(@reap) ? @reap : true
|
|
18
32
|
end
|
|
19
33
|
|
|
20
34
|
def tmp_files
|
|
@@ -29,9 +43,7 @@ module Selenium
|
|
|
29
43
|
def reap(file)
|
|
30
44
|
return unless reap?
|
|
31
45
|
|
|
32
|
-
unless tmp_files.include?(file)
|
|
33
|
-
raise Error::WebDriverError, "file not added for reaping: #{file.inspect}"
|
|
34
|
-
end
|
|
46
|
+
raise Error::WebDriverError, "file not added for reaping: #{file.inspect}" unless tmp_files.include?(file)
|
|
35
47
|
|
|
36
48
|
FileUtils.rm_rf tmp_files.delete(file)
|
|
37
49
|
end
|
|
@@ -48,7 +60,6 @@ module Selenium
|
|
|
48
60
|
|
|
49
61
|
# we *do* want child process reaping, so not using Platform.exit_hook here.
|
|
50
62
|
at_exit { reap! }
|
|
51
|
-
|
|
52
63
|
end # FileReaper
|
|
53
64
|
end # WebDriver
|
|
54
|
-
end # Selenium
|
|
65
|
+
end # Selenium
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
|
|
1
20
|
module Selenium
|
|
2
21
|
module WebDriver
|
|
3
22
|
module HTML5
|
|
4
|
-
|
|
5
23
|
class LocalStorage
|
|
6
24
|
include SharedWebStorage
|
|
7
25
|
|
|
@@ -13,30 +31,29 @@ module Selenium
|
|
|
13
31
|
end
|
|
14
32
|
|
|
15
33
|
def [](key)
|
|
16
|
-
@bridge.
|
|
34
|
+
@bridge.local_storage_item key
|
|
17
35
|
end
|
|
18
36
|
|
|
19
37
|
def []=(key, value)
|
|
20
|
-
@bridge.
|
|
38
|
+
@bridge.local_storage_item key, value
|
|
21
39
|
end
|
|
22
40
|
|
|
23
41
|
def delete(key)
|
|
24
|
-
@bridge.
|
|
42
|
+
@bridge.remove_local_storage_item key
|
|
25
43
|
end
|
|
26
44
|
|
|
27
45
|
def clear
|
|
28
|
-
@bridge.
|
|
46
|
+
@bridge.clear_local_storage
|
|
29
47
|
end
|
|
30
48
|
|
|
31
49
|
def size
|
|
32
|
-
@bridge.
|
|
50
|
+
@bridge.local_storage_size
|
|
33
51
|
end
|
|
34
52
|
|
|
35
53
|
def keys
|
|
36
|
-
@bridge.
|
|
54
|
+
@bridge.local_storage_keys.reverse
|
|
37
55
|
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
end
|
|
56
|
+
end # LocalStorage
|
|
57
|
+
end # HTML5
|
|
58
|
+
end # WebDriver
|
|
59
|
+
end # Selenium
|