selenium-webdriver 3.141.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 +4 -4
- data/CHANGES +150 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/lib/selenium/server.rb +9 -7
- data/lib/selenium/webdriver/atoms/getAttribute.js +6 -7
- data/lib/selenium/webdriver/atoms/isDisplayed.js +60 -59
- data/lib/selenium/webdriver/atoms.rb +20 -1
- data/lib/selenium/webdriver/chrome/bridge.rb +23 -3
- data/lib/selenium/webdriver/chrome/driver.rb +30 -20
- data/lib/selenium/webdriver/chrome/options.rb +11 -7
- data/lib/selenium/webdriver/chrome/profile.rb +6 -5
- data/lib/selenium/webdriver/chrome/service.rb +13 -13
- data/lib/selenium/webdriver/chrome.rb +10 -4
- data/lib/selenium/webdriver/common/action_builder.rb +2 -0
- data/lib/selenium/webdriver/common/alert.rb +2 -0
- data/lib/selenium/webdriver/common/bridge_helper.rb +8 -5
- data/lib/selenium/webdriver/common/driver.rb +22 -7
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -3
- data/lib/selenium/webdriver/common/element.rb +3 -1
- data/lib/selenium/webdriver/common/error.rb +74 -18
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -3
- data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -0
- data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -0
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +4 -1
- data/lib/selenium/webdriver/common/interactions/input_device.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/interactions.rb +3 -1
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +2 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +4 -0
- data/lib/selenium/webdriver/common/interactions/none_input.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +2 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +7 -0
- data/lib/selenium/webdriver/common/keyboard.rb +4 -1
- data/lib/selenium/webdriver/common/keys.rb +3 -0
- data/lib/selenium/webdriver/common/log_entry.rb +4 -2
- data/lib/selenium/webdriver/common/logger.rb +15 -40
- data/lib/selenium/webdriver/common/logs.rb +2 -0
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/mouse.rb +3 -0
- data/lib/selenium/webdriver/common/navigation.rb +2 -0
- data/lib/selenium/webdriver/common/options.rb +28 -126
- data/lib/selenium/webdriver/common/platform.rb +26 -30
- data/lib/selenium/webdriver/common/port_prober.rb +6 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +2 -0
- data/lib/selenium/webdriver/common/proxy.rb +13 -5
- data/lib/selenium/webdriver/common/search_context.rb +6 -8
- data/lib/selenium/webdriver/common/service.rb +87 -29
- data/lib/selenium/webdriver/common/socket_lock.rb +10 -3
- data/lib/selenium/webdriver/common/socket_poller.rb +26 -18
- data/lib/selenium/webdriver/common/target_locator.rb +6 -4
- data/lib/selenium/webdriver/common/timeouts.rb +2 -0
- data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -6
- data/lib/selenium/webdriver/common/touch_screen.rb +4 -1
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +3 -0
- data/lib/selenium/webdriver/common/{w3c_options.rb → w3c_manager.rb} +3 -1
- data/lib/selenium/webdriver/common/wait.rb +13 -5
- data/lib/selenium/webdriver/common/window.rb +2 -0
- data/lib/selenium/webdriver/common/zipper.rb +3 -3
- data/lib/selenium/webdriver/common.rb +5 -2
- data/lib/selenium/webdriver/edge/bridge.rb +2 -0
- data/lib/selenium/webdriver/edge/driver.rb +6 -13
- data/lib/selenium/webdriver/edge/options.rb +3 -0
- data/lib/selenium/webdriver/edge/service.rb +8 -12
- data/lib/selenium/webdriver/edge.rb +11 -5
- data/lib/selenium/webdriver/firefox/binary.rb +9 -8
- data/lib/selenium/webdriver/firefox/driver.rb +2 -0
- data/lib/selenium/webdriver/firefox/extension.rb +4 -4
- data/lib/selenium/webdriver/firefox/launcher.rb +3 -0
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +7 -3
- data/lib/selenium/webdriver/firefox/marionette/bridge.rb +4 -2
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +6 -12
- data/lib/selenium/webdriver/firefox/options.rb +22 -9
- data/lib/selenium/webdriver/firefox/profile.rb +7 -8
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +3 -0
- data/lib/selenium/webdriver/firefox/service.rb +8 -19
- data/lib/selenium/webdriver/firefox/util.rb +2 -0
- data/lib/selenium/webdriver/firefox.rb +10 -4
- data/lib/selenium/webdriver/ie/driver.rb +5 -11
- data/lib/selenium/webdriver/ie/options.rb +6 -4
- data/lib/selenium/webdriver/ie/service.rb +8 -12
- data/lib/selenium/webdriver/ie.rb +10 -4
- data/lib/selenium/webdriver/remote/bridge.rb +8 -6
- data/lib/selenium/webdriver/remote/capabilities.rb +23 -10
- data/lib/selenium/webdriver/remote/driver.rb +2 -0
- data/lib/selenium/webdriver/remote/http/common.rb +11 -4
- data/lib/selenium/webdriver/remote/http/curb.rb +4 -2
- data/lib/selenium/webdriver/remote/http/default.rb +31 -25
- data/lib/selenium/webdriver/remote/http/persistent.rb +3 -1
- data/lib/selenium/webdriver/remote/oss/bridge.rb +5 -2
- data/lib/selenium/webdriver/remote/oss/commands.rb +106 -104
- data/lib/selenium/webdriver/remote/response.rb +11 -3
- data/lib/selenium/webdriver/remote/server_error.rb +2 -0
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +28 -13
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +37 -21
- data/lib/selenium/webdriver/remote/w3c/commands.rb +61 -58
- data/lib/selenium/webdriver/remote.rb +2 -0
- data/lib/selenium/webdriver/safari/bridge.rb +5 -3
- data/lib/selenium/webdriver/safari/driver.rb +9 -11
- data/lib/selenium/webdriver/safari/options.rb +2 -0
- data/lib/selenium/webdriver/safari/service.rb +6 -25
- data/lib/selenium/webdriver/safari.rb +11 -4
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -0
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -1
- data/lib/selenium/webdriver/support/color.rb +11 -9
- data/lib/selenium/webdriver/support/escaper.rb +2 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -1
- data/lib/selenium/webdriver/support/select.rb +19 -18
- data/lib/selenium/webdriver/support.rb +2 -0
- data/lib/selenium/webdriver/version.rb +3 -1
- data/lib/selenium/webdriver.rb +3 -1
- data/lib/selenium-webdriver.rb +2 -0
- data/selenium-webdriver.gemspec +15 -8
- metadata +86 -27
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -23,28 +25,26 @@ module Selenium
|
|
|
23
25
|
#
|
|
24
26
|
|
|
25
27
|
class Service < WebDriver::Service
|
|
26
|
-
|
|
27
|
-
@executable = 'chromedriver'
|
|
28
|
-
@missing_text =
|
|
28
|
+
@default_port = 9515
|
|
29
|
+
@executable = 'chromedriver'
|
|
30
|
+
@missing_text = <<~ERROR
|
|
29
31
|
Unable to find chromedriver. Please download the server from
|
|
30
|
-
|
|
32
|
+
https://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
|
|
31
33
|
More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
|
|
32
34
|
ERROR
|
|
35
|
+
@shutdown_supported = true
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@process = build_process(@executable_path, "--port=#{@port}", *@extra_args)
|
|
38
|
-
@process.leader = true unless Platform.windows?
|
|
39
|
-
@process.start
|
|
37
|
+
def self.driver_path=(path)
|
|
38
|
+
Platform.assert_executable path if path.is_a?(String)
|
|
39
|
+
@driver_path = path
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
"unable to connect to chromedriver #{@host}:#{@port}"
|
|
44
|
-
end
|
|
42
|
+
private
|
|
45
43
|
|
|
44
|
+
# Note: This processing is deprecated
|
|
46
45
|
def extract_service_args(driver_opts)
|
|
47
46
|
driver_args = super
|
|
47
|
+
driver_opts = driver_opts.dup
|
|
48
48
|
driver_args << "--log-path=#{driver_opts.delete(:log_path)}" if driver_opts.key?(:log_path)
|
|
49
49
|
driver_args << "--url-base=#{driver_opts.delete(:url_base)}" if driver_opts.key?(:url_base)
|
|
50
50
|
driver_args << "--port-server=#{driver_opts.delete(:port_server)}" if driver_opts.key?(:port_server)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -18,7 +20,6 @@
|
|
|
18
20
|
require 'net/http'
|
|
19
21
|
|
|
20
22
|
require 'selenium/webdriver/chrome/bridge'
|
|
21
|
-
require 'selenium/webdriver/chrome/service'
|
|
22
23
|
require 'selenium/webdriver/chrome/driver'
|
|
23
24
|
require 'selenium/webdriver/chrome/profile'
|
|
24
25
|
require 'selenium/webdriver/chrome/options'
|
|
@@ -27,12 +28,15 @@ module Selenium
|
|
|
27
28
|
module WebDriver
|
|
28
29
|
module Chrome
|
|
29
30
|
def self.driver_path=(path)
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome#driver_path=',
|
|
32
|
+
'Selenium::WebDriver::Chrome::Service#driver_path='
|
|
33
|
+
Selenium::WebDriver::Chrome::Service.driver_path = path
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def self.driver_path
|
|
35
|
-
|
|
37
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome#driver_path',
|
|
38
|
+
'Selenium::WebDriver::Chrome::Service#driver_path'
|
|
39
|
+
Selenium::WebDriver::Chrome::Service.driver_path
|
|
36
40
|
end
|
|
37
41
|
|
|
38
42
|
def self.path=(path)
|
|
@@ -46,3 +50,5 @@ module Selenium
|
|
|
46
50
|
end # Chrome
|
|
47
51
|
end # WebDriver
|
|
48
52
|
end # Selenium
|
|
53
|
+
|
|
54
|
+
require 'selenium/webdriver/chrome/service'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -31,6 +33,7 @@ module Selenium
|
|
|
31
33
|
when Hash
|
|
32
34
|
element_id = element_id_from(arg)
|
|
33
35
|
return Element.new(self, element_id) if element_id
|
|
36
|
+
|
|
34
37
|
arg.each { |k, v| arg[k] = unwrap_script_result(v) }
|
|
35
38
|
else
|
|
36
39
|
arg
|
|
@@ -43,12 +46,12 @@ module Selenium
|
|
|
43
46
|
|
|
44
47
|
def parse_cookie_string(str)
|
|
45
48
|
result = {
|
|
46
|
-
'name'
|
|
47
|
-
'value'
|
|
48
|
-
'domain'
|
|
49
|
-
'path'
|
|
49
|
+
'name' => '',
|
|
50
|
+
'value' => '',
|
|
51
|
+
'domain' => '',
|
|
52
|
+
'path' => '',
|
|
50
53
|
'expires' => '',
|
|
51
|
-
'secure'
|
|
54
|
+
'secure' => false
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
str.split(';').each do |attribute|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -73,7 +75,7 @@ module Selenium
|
|
|
73
75
|
end
|
|
74
76
|
|
|
75
77
|
def inspect
|
|
76
|
-
format '
|
|
78
|
+
format '#<%<class>s:0x%<hash>x browser=%<browser>s>', class: self.class, hash: hash * 2, browser: bridge.browser.inspect
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
#
|
|
@@ -95,12 +97,12 @@ module Selenium
|
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
#
|
|
98
|
-
# @return [
|
|
99
|
-
# @see
|
|
100
|
+
# @return [Manager]
|
|
101
|
+
# @see Manager
|
|
100
102
|
#
|
|
101
103
|
|
|
102
104
|
def manage
|
|
103
|
-
bridge.
|
|
105
|
+
bridge.manage
|
|
104
106
|
end
|
|
105
107
|
|
|
106
108
|
#
|
|
@@ -281,13 +283,26 @@ module Selenium
|
|
|
281
283
|
# @see SearchContext
|
|
282
284
|
#
|
|
283
285
|
|
|
284
|
-
def ref
|
|
285
|
-
nil
|
|
286
|
-
end
|
|
286
|
+
def ref; end
|
|
287
287
|
|
|
288
288
|
private
|
|
289
289
|
|
|
290
290
|
attr_reader :bridge
|
|
291
|
+
|
|
292
|
+
def service_url(opts)
|
|
293
|
+
@service = opts.delete(:service)
|
|
294
|
+
%i[driver_opts driver_path port].each do |key|
|
|
295
|
+
next unless opts.key? key
|
|
296
|
+
|
|
297
|
+
WebDriver.logger.deprecate(":#{key}", ':service with an instance of Selenium::WebDriver::Service')
|
|
298
|
+
end
|
|
299
|
+
@service ||= Service.send(browser,
|
|
300
|
+
args: opts.delete(:driver_opts),
|
|
301
|
+
path: opts.delete(:driver_path),
|
|
302
|
+
port: opts.delete(:port))
|
|
303
|
+
@service.start
|
|
304
|
+
@service.uri
|
|
305
|
+
end
|
|
291
306
|
end # Driver
|
|
292
307
|
end # WebDriver
|
|
293
308
|
end # Selenium
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -24,9 +26,7 @@ module Selenium
|
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def location=(loc)
|
|
27
|
-
unless loc.is_a?(Location)
|
|
28
|
-
raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}"
|
|
29
|
-
end
|
|
29
|
+
raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}" unless loc.is_a?(Location)
|
|
30
30
|
|
|
31
31
|
@bridge.set_location loc.latitude, loc.longitude, loc.altitude
|
|
32
32
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -48,7 +50,7 @@ module Selenium
|
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
def valid_type?(type)
|
|
51
|
-
type_to_values.
|
|
53
|
+
type_to_values.key? type
|
|
52
54
|
end
|
|
53
55
|
end # HasNetworkConnection
|
|
54
56
|
end # DriverExtensions
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -23,7 +25,7 @@ module Selenium
|
|
|
23
25
|
|
|
24
26
|
module DriverExtensions
|
|
25
27
|
module Rotatable
|
|
26
|
-
ORIENTATIONS = [
|
|
28
|
+
ORIENTATIONS = %i[landscape portrait].freeze
|
|
27
29
|
|
|
28
30
|
#
|
|
29
31
|
# Change the screen orientation
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -48,9 +50,7 @@ module Selenium
|
|
|
48
50
|
#
|
|
49
51
|
|
|
50
52
|
def file_detector=(detector)
|
|
51
|
-
unless detector.nil? || detector.respond_to?(:call)
|
|
52
|
-
raise ArgumentError, 'detector must respond to #call'
|
|
53
|
-
end
|
|
53
|
+
raise ArgumentError, 'detector must respond to #call' unless detector.nil? || detector.respond_to?(:call)
|
|
54
54
|
|
|
55
55
|
bridge.file_detector = detector
|
|
56
56
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -32,7 +34,7 @@ module Selenium
|
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def inspect
|
|
35
|
-
format '
|
|
37
|
+
format '#<%<class>s:0x%<hash>x id=%<id>s>', class: self.class, hash: hash * 2, id: @id.inspect
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
def ==(other)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
|
|
18
20
|
module Selenium
|
|
19
21
|
module WebDriver
|
|
20
|
-
module Error
|
|
22
|
+
module Error # rubocop:disable Metrics/ModuleLength
|
|
21
23
|
|
|
22
24
|
#
|
|
23
25
|
# Returns exception from code (Integer - OSS, String - W3C).
|
|
@@ -29,7 +31,7 @@ module Selenium
|
|
|
29
31
|
when nil, 0
|
|
30
32
|
nil
|
|
31
33
|
when Integer
|
|
32
|
-
ERRORS.fetch(code)
|
|
34
|
+
Object.const_get(ERRORS.fetch(code).to_s)
|
|
33
35
|
when String
|
|
34
36
|
klass_name = code.split(' ').map(&:capitalize).join.sub(/Error$/, '')
|
|
35
37
|
const_get("#{klass_name}Error", false)
|
|
@@ -210,6 +212,13 @@ module Selenium
|
|
|
210
212
|
|
|
211
213
|
class ElementNotInteractableError < WebDriverError; end
|
|
212
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
|
+
|
|
213
222
|
#
|
|
214
223
|
# The arguments passed to a command are either invalid or malformed.
|
|
215
224
|
#
|
|
@@ -263,30 +272,30 @@ module Selenium
|
|
|
263
272
|
class UnsupportedOperationError < WebDriverError; end
|
|
264
273
|
|
|
265
274
|
# Aliases for OSS dialect.
|
|
266
|
-
ScriptTimeoutError = ScriptTimeOutError
|
|
267
|
-
TimeoutError = TimeOutError
|
|
268
|
-
NoAlertOpenError = NoAlertPresentError
|
|
275
|
+
ScriptTimeoutError = Class.new(ScriptTimeOutError)
|
|
276
|
+
TimeoutError = Class.new(TimeOutError)
|
|
277
|
+
NoAlertOpenError = Class.new(NoAlertPresentError)
|
|
269
278
|
|
|
270
279
|
# Aliases for backwards compatibility.
|
|
271
|
-
ObsoleteElementError = StaleElementReferenceError
|
|
272
|
-
UnhandledError = UnknownError
|
|
273
|
-
UnexpectedJavascriptError = JavascriptError
|
|
274
|
-
ElementNotDisplayedError = ElementNotVisibleError
|
|
280
|
+
ObsoleteElementError = Class.new(StaleElementReferenceError)
|
|
281
|
+
UnhandledError = Class.new(UnknownError)
|
|
282
|
+
UnexpectedJavascriptError = Class.new(JavascriptError)
|
|
283
|
+
ElementNotDisplayedError = Class.new(ElementNotVisibleError)
|
|
275
284
|
|
|
276
285
|
#
|
|
277
286
|
# @api private
|
|
278
287
|
#
|
|
279
288
|
|
|
280
289
|
ERRORS = {
|
|
281
|
-
1
|
|
282
|
-
2
|
|
283
|
-
3
|
|
284
|
-
4
|
|
285
|
-
5
|
|
286
|
-
6
|
|
287
|
-
7
|
|
288
|
-
8
|
|
289
|
-
9
|
|
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,
|
|
290
299
|
10 => StaleElementReferenceError,
|
|
291
300
|
11 => ElementNotVisibleError,
|
|
292
301
|
12 => InvalidElementStateError,
|
|
@@ -322,6 +331,53 @@ module Selenium
|
|
|
322
331
|
63 => UnableToCaptureScreenError
|
|
323
332
|
}.freeze
|
|
324
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
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
|
|
325
381
|
end # Error
|
|
326
382
|
end # WebDriver
|
|
327
383
|
end # Selenium
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -41,9 +43,7 @@ module Selenium
|
|
|
41
43
|
def reap(file)
|
|
42
44
|
return unless reap?
|
|
43
45
|
|
|
44
|
-
unless tmp_files.include?(file)
|
|
45
|
-
raise Error::WebDriverError, "file not added for reaping: #{file.inspect}"
|
|
46
|
-
end
|
|
46
|
+
raise Error::WebDriverError, "file not added for reaping: #{file.inspect}" unless tmp_files.include?(file)
|
|
47
47
|
|
|
48
48
|
FileUtils.rm_rf tmp_files.delete(file)
|
|
49
49
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -30,6 +32,7 @@ module Selenium
|
|
|
30
32
|
def fetch(key)
|
|
31
33
|
return self[key] if key? key
|
|
32
34
|
return yield(key) if block_given?
|
|
35
|
+
|
|
33
36
|
raise KeyError, "missing key #{key.inspect}"
|
|
34
37
|
end
|
|
35
38
|
|
|
@@ -40,7 +43,7 @@ module Selenium
|
|
|
40
43
|
def each
|
|
41
44
|
return enum_for(:each) unless block_given?
|
|
42
45
|
|
|
43
|
-
keys.each do |k|
|
|
46
|
+
keys.each do |k|
|
|
44
47
|
yield k, self[k]
|
|
45
48
|
end
|
|
46
49
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -30,6 +32,7 @@ module Selenium
|
|
|
30
32
|
|
|
31
33
|
def add_action(action)
|
|
32
34
|
raise TypeError, "#{action.inspect} is not a valid action" unless action.class < Interaction
|
|
35
|
+
|
|
33
36
|
@actions << action
|
|
34
37
|
end
|
|
35
38
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -25,6 +27,7 @@ module Selenium
|
|
|
25
27
|
|
|
26
28
|
def initialize(source)
|
|
27
29
|
raise TypeError, "#{source.type} is not a valid input type" unless Interactions::SOURCE_TYPES.include? source.type
|
|
30
|
+
|
|
28
31
|
@source = source
|
|
29
32
|
end
|
|
30
33
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -13,7 +15,7 @@
|
|
|
13
15
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
16
|
# KIND, either express or implied. See the License for the
|
|
15
17
|
# specific language governing permissions and limitations
|
|
16
|
-
# under the License
|
|
18
|
+
# under the License.
|
|
17
19
|
|
|
18
20
|
module Selenium
|
|
19
21
|
module WebDriver
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -27,6 +29,7 @@ module Selenium
|
|
|
27
29
|
|
|
28
30
|
def encode
|
|
29
31
|
return nil if no_actions?
|
|
32
|
+
|
|
30
33
|
{type: type, id: name, actions: @actions.map(&:encode)}
|
|
31
34
|
end
|
|
32
35
|
|
|
@@ -49,6 +52,7 @@ module Selenium
|
|
|
49
52
|
|
|
50
53
|
def assert_type(type)
|
|
51
54
|
raise TypeError, "#{type.inspect} is not a valid key subtype" unless KeyInput::SUBTYPES.key? type
|
|
55
|
+
|
|
52
56
|
KeyInput::SUBTYPES[type]
|
|
53
57
|
end
|
|
54
58
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
|
3
5
|
# distributed with this work for additional information
|
|
@@ -25,6 +27,7 @@ module Selenium
|
|
|
25
27
|
|
|
26
28
|
def encode
|
|
27
29
|
return nil if no_actions?
|
|
30
|
+
|
|
28
31
|
{type: type, id: name, actions: @actions.map(&:encode)}
|
|
29
32
|
end
|
|
30
33
|
end # NoneInput
|