selenium-webdriver 4.7.0 → 4.8.0
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 +34 -0
- data/LICENSE +1 -1
- data/NOTICE +1 -1
- data/lib/selenium/server.rb +1 -0
- data/lib/selenium/webdriver/atoms.rb +2 -3
- data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
- data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
- data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
- data/lib/selenium/webdriver/bidi/log_inspector.rb +140 -0
- data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
- data/lib/selenium/webdriver/bidi/session.rb +13 -0
- data/lib/selenium/webdriver/bidi.rb +2 -1
- data/lib/selenium/webdriver/chrome/driver.rb +19 -29
- data/lib/selenium/webdriver/chrome/features.rb +5 -72
- data/lib/selenium/webdriver/chrome/options.rb +3 -237
- data/lib/selenium/webdriver/chrome/profile.rb +3 -83
- data/lib/selenium/webdriver/chrome/service.rb +3 -18
- data/lib/selenium/webdriver/chromium/driver.rb +61 -0
- data/lib/selenium/webdriver/chromium/features.rb +103 -0
- data/lib/selenium/webdriver/chromium/options.rb +261 -0
- data/lib/selenium/webdriver/chromium/profile.rb +113 -0
- data/lib/selenium/webdriver/chromium/service.rb +42 -0
- data/lib/selenium/webdriver/chromium.rb +32 -0
- data/lib/selenium/webdriver/common/action_builder.rb +11 -48
- data/lib/selenium/webdriver/common/child_process.rb +0 -2
- data/lib/selenium/webdriver/common/driver.rb +34 -25
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_bidi.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +1 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +0 -2
- data/lib/selenium/webdriver/common/element.rb +6 -6
- data/lib/selenium/webdriver/common/error.rb +0 -2
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +3 -3
- data/lib/selenium/webdriver/common/interactions/pointer_move.rb +2 -2
- data/lib/selenium/webdriver/common/interactions/scroll.rb +7 -5
- data/lib/selenium/webdriver/common/logger.rb +10 -2
- data/lib/selenium/webdriver/common/options.rb +30 -8
- data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
- data/lib/selenium/webdriver/common/proxy.rb +1 -1
- data/lib/selenium/webdriver/common/selenium_manager.rb +10 -12
- data/lib/selenium/webdriver/common/service.rb +9 -5
- data/lib/selenium/webdriver/common/service_manager.rb +1 -1
- data/lib/selenium/webdriver/common/shadow_root.rb +1 -2
- data/lib/selenium/webdriver/common/socket_lock.rb +1 -0
- data/lib/selenium/webdriver/common/takes_screenshot.rb +2 -3
- data/lib/selenium/webdriver/common/target_locator.rb +2 -3
- data/lib/selenium/webdriver/common/timeouts.rb +2 -2
- data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +8 -6
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +0 -1
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +16 -16
- data/lib/selenium/webdriver/common/websocket_connection.rb +1 -2
- data/lib/selenium/webdriver/devtools/console_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/exception_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/mutation_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/network_interceptor.rb +3 -6
- data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
- data/lib/selenium/webdriver/devtools/request.rb +0 -2
- data/lib/selenium/webdriver/devtools/response.rb +0 -2
- data/lib/selenium/webdriver/devtools.rb +0 -1
- data/lib/selenium/webdriver/edge/driver.rb +20 -3
- data/lib/selenium/webdriver/edge/features.rb +3 -4
- data/lib/selenium/webdriver/edge/options.rb +3 -5
- data/lib/selenium/webdriver/edge/profile.rb +2 -2
- data/lib/selenium/webdriver/edge/service.rb +2 -2
- data/lib/selenium/webdriver/firefox/driver.rb +19 -2
- data/lib/selenium/webdriver/firefox/features.rb +0 -1
- data/lib/selenium/webdriver/firefox/options.rb +4 -1
- data/lib/selenium/webdriver/firefox/profile.rb +6 -6
- data/lib/selenium/webdriver/firefox/service.rb +0 -1
- data/lib/selenium/webdriver/ie/driver.rb +20 -1
- data/lib/selenium/webdriver/ie/service.rb +1 -2
- data/lib/selenium/webdriver/remote/bridge.rb +8 -15
- data/lib/selenium/webdriver/remote/capabilities.rb +34 -12
- data/lib/selenium/webdriver/remote/commands.rb +0 -2
- data/lib/selenium/webdriver/remote/driver.rb +13 -13
- data/lib/selenium/webdriver/remote/http/curb.rb +0 -2
- data/lib/selenium/webdriver/remote/http/default.rb +1 -0
- data/lib/selenium/webdriver/remote/response.rb +0 -1
- data/lib/selenium/webdriver/safari/driver.rb +20 -1
- data/lib/selenium/webdriver/safari/features.rb +0 -2
- data/lib/selenium/webdriver/safari/options.rb +5 -1
- data/lib/selenium/webdriver/safari.rb +1 -1
- data/lib/selenium/webdriver/support/color.rb +15 -15
- data/lib/selenium/webdriver/support/guards/guard.rb +0 -2
- data/lib/selenium/webdriver/support/guards/guard_condition.rb +0 -2
- data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +3 -3
- data/selenium-webdriver.gemspec +3 -5
- metadata +25 -41
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
- data/lib/selenium/webdriver/support/nightly_version_generator.rb +0 -60
|
@@ -27,24 +27,22 @@ module Selenium
|
|
|
27
27
|
# @api private
|
|
28
28
|
#
|
|
29
29
|
class SeleniumManager
|
|
30
|
-
BIN_PATH =
|
|
30
|
+
BIN_PATH = '../../../../../bin'
|
|
31
31
|
|
|
32
32
|
class << self
|
|
33
33
|
# @param [String] driver_name which driver to use.
|
|
34
34
|
# @return [String] the path to the correct driver.
|
|
35
35
|
def driver_path(driver_name)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
36
|
+
unless %w[chromedriver geckodriver msedgedriver IEDriverServer].include?(driver_name)
|
|
37
|
+
msg = "Unable to locate driver with name: #{driver_name}"
|
|
38
|
+
raise Error::WebDriverError, msg
|
|
39
|
+
end
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
location = run("#{binary} --driver #{driver_name}")
|
|
42
|
+
WebDriver.logger.debug("Driver found at #{location}")
|
|
43
|
+
Platform.assert_executable location
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
end
|
|
45
|
+
location
|
|
48
46
|
end
|
|
49
47
|
|
|
50
48
|
private
|
|
@@ -62,7 +60,7 @@ module Selenium
|
|
|
62
60
|
end
|
|
63
61
|
location = File.expand_path(path, __FILE__)
|
|
64
62
|
unless location.is_a?(String) && File.exist?(location) && File.executable?(location)
|
|
65
|
-
raise Error::WebDriverError,
|
|
63
|
+
raise Error::WebDriverError, 'Unable to obtain Selenium Manager'
|
|
66
64
|
end
|
|
67
65
|
|
|
68
66
|
WebDriver.logger.debug("Selenium Manager found at #{location}")
|
|
@@ -39,12 +39,13 @@ module Selenium
|
|
|
39
39
|
def ie(**opts)
|
|
40
40
|
IE::Service.new(**opts)
|
|
41
41
|
end
|
|
42
|
-
|
|
42
|
+
alias internet_explorer ie
|
|
43
43
|
|
|
44
44
|
def edge(**opts)
|
|
45
45
|
Edge::Service.new(**opts)
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
alias microsoftedge edge
|
|
48
|
+
alias msedge edge
|
|
48
49
|
|
|
49
50
|
def safari(**opts)
|
|
50
51
|
Safari::Service.new(**opts)
|
|
@@ -56,8 +57,8 @@ module Selenium
|
|
|
56
57
|
end
|
|
57
58
|
end
|
|
58
59
|
|
|
59
|
-
attr_accessor :host
|
|
60
|
-
|
|
60
|
+
attr_accessor :host, :executable_path, :port, :args
|
|
61
|
+
alias extra_args args
|
|
61
62
|
|
|
62
63
|
#
|
|
63
64
|
# End users should use a class method for the desired driver, rather than using this directly.
|
|
@@ -74,7 +75,7 @@ module Selenium
|
|
|
74
75
|
@host = Platform.localhost
|
|
75
76
|
@port = Integer(port)
|
|
76
77
|
|
|
77
|
-
@
|
|
78
|
+
@args = args.is_a?(Hash) ? extract_service_args(args) : args
|
|
78
79
|
|
|
79
80
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
|
80
81
|
end
|
|
@@ -90,6 +91,9 @@ module Selenium
|
|
|
90
91
|
protected
|
|
91
92
|
|
|
92
93
|
def extract_service_args(driver_opts)
|
|
94
|
+
WebDriver.logger.deprecate('initializing Service class with :args using Hash',
|
|
95
|
+
':args parameter with an Array of String values',
|
|
96
|
+
id: :driver_opts)
|
|
93
97
|
driver_opts.key?(:args) ? driver_opts.delete(:args) : []
|
|
94
98
|
end
|
|
95
99
|
|
|
@@ -40,7 +40,7 @@ module Selenium
|
|
|
40
40
|
@executable_path = config.executable_path
|
|
41
41
|
@host = Platform.localhost
|
|
42
42
|
@port = config.port
|
|
43
|
-
@extra_args = config.
|
|
43
|
+
@extra_args = config.args
|
|
44
44
|
@shutdown_supported = config.shutdown_supported
|
|
45
45
|
|
|
46
46
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
|
@@ -42,7 +42,7 @@ module Selenium
|
|
|
42
42
|
def ==(other)
|
|
43
43
|
other.is_a?(self.class) && ref == other.ref
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
alias eql? ==
|
|
46
46
|
|
|
47
47
|
def hash
|
|
48
48
|
[@id, @bridge].hash
|
|
@@ -81,7 +81,6 @@ module Selenium
|
|
|
81
81
|
private
|
|
82
82
|
|
|
83
83
|
attr_reader :bridge
|
|
84
|
-
|
|
85
84
|
end # ShadowRoot
|
|
86
85
|
end # WebDriver
|
|
87
86
|
end # Selenium
|
|
@@ -32,8 +32,8 @@ module Selenium
|
|
|
32
32
|
def save_screenshot(png_path, full_page: false)
|
|
33
33
|
extension = File.extname(png_path).downcase
|
|
34
34
|
if extension != '.png'
|
|
35
|
-
WebDriver.logger.warn
|
|
36
|
-
|
|
35
|
+
WebDriver.logger.warn 'name used for saved screenshot does not match file type. ' \
|
|
36
|
+
'It should end with .png extension',
|
|
37
37
|
id: :screenshot
|
|
38
38
|
end
|
|
39
39
|
File.open(png_path, 'wb') { |f| f << screenshot_as(:png, full_page: full_page) }
|
|
@@ -60,7 +60,6 @@ module Selenium
|
|
|
60
60
|
rescue NameError
|
|
61
61
|
raise Error::UnsupportedOperationError, "Full Page Screenshots are not supported for #{inspect}"
|
|
62
62
|
end
|
|
63
|
-
|
|
64
63
|
end # TakesScreenshot
|
|
65
64
|
end # WebDriver
|
|
66
65
|
end # Selenium
|
|
@@ -51,9 +51,8 @@ module Selenium
|
|
|
51
51
|
#
|
|
52
52
|
|
|
53
53
|
def new_window(type = :window)
|
|
54
|
-
unless %i[window
|
|
55
|
-
|
|
56
|
-
end
|
|
54
|
+
raise ArgumentError, "Valid types are :tab and :window, received: #{type.inspect}" unless %i[window
|
|
55
|
+
tab].include?(type)
|
|
57
56
|
|
|
58
57
|
handle = @bridge.new_window(type)['handle']
|
|
59
58
|
|
|
@@ -48,7 +48,7 @@ module Selenium
|
|
|
48
48
|
def script
|
|
49
49
|
Float(@bridge.timeouts['script']) / 1000
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
alias script_timeout script
|
|
52
52
|
|
|
53
53
|
#
|
|
54
54
|
# Sets the amount of time to wait for an asynchronous script to finish
|
|
@@ -59,7 +59,7 @@ module Selenium
|
|
|
59
59
|
def script=(seconds)
|
|
60
60
|
@bridge.timeouts = {'script' => Integer(seconds * 1000)}
|
|
61
61
|
end
|
|
62
|
-
|
|
62
|
+
alias script_timeout= script=
|
|
63
63
|
|
|
64
64
|
#
|
|
65
65
|
# Gets the amount of time to wait for a page load to complete before throwing an error.
|
|
@@ -44,8 +44,8 @@ module Selenium
|
|
|
44
44
|
|
|
45
45
|
def from_json(opts)
|
|
46
46
|
user_handle = opts['userHandle'] ? decode(opts['userHandle']) : nil
|
|
47
|
-
new(id: decode(opts[
|
|
48
|
-
resident_credential: opts[
|
|
47
|
+
new(id: decode(opts['credentialId']),
|
|
48
|
+
resident_credential: opts['isResidentCredential'],
|
|
49
49
|
rp_id: opts['rpId'],
|
|
50
50
|
private_key: opts['privateKey'],
|
|
51
51
|
sign_count: opts['signCount'],
|
|
@@ -54,15 +54,17 @@ module Selenium
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count
|
|
57
|
-
|
|
57
|
+
alias resident_credential? resident_credential
|
|
58
58
|
|
|
59
|
-
def initialize(id:, resident_credential:, rp_id:, private_key:,
|
|
59
|
+
def initialize(id:, resident_credential:, rp_id:, private_key:, **opts)
|
|
60
60
|
@id = id
|
|
61
61
|
@resident_credential = resident_credential
|
|
62
62
|
@rp_id = rp_id
|
|
63
|
-
@user_handle = user_handle
|
|
63
|
+
@user_handle = opts.delete(:user_handle) { nil }
|
|
64
64
|
@private_key = private_key
|
|
65
|
-
@sign_count = sign_count
|
|
65
|
+
@sign_count = opts.delete(:sign_count) { 0 }
|
|
66
|
+
|
|
67
|
+
raise ArgumentError, "Invalid arguments: #{opts.keys}" unless opts.empty?
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
#
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
module Selenium
|
|
26
26
|
module WebDriver
|
|
27
27
|
class VirtualAuthenticatorOptions
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
TRANSPORT = {ble: "ble", usb: "usb", nfc: "nfc", internal: "internal"}.freeze
|
|
28
|
+
PROTOCOL = {ctap2: 'ctap2', u2f: 'ctap1/u2f'}.freeze
|
|
29
|
+
TRANSPORT = {ble: 'ble', usb: 'usb', nfc: 'nfc', internal: 'internal'}.freeze
|
|
31
30
|
|
|
32
31
|
attr_accessor :protocol, :transport, :resident_key, :user_verification, :user_consenting, :user_verified
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def initialize(
|
|
39
|
-
|
|
40
|
-
@
|
|
41
|
-
@
|
|
42
|
-
@
|
|
43
|
-
@
|
|
44
|
-
@
|
|
45
|
-
|
|
32
|
+
alias resident_key? resident_key
|
|
33
|
+
alias user_verification? user_verification
|
|
34
|
+
alias user_consenting? user_consenting
|
|
35
|
+
alias user_verified? user_verified
|
|
36
|
+
|
|
37
|
+
def initialize(**opts)
|
|
38
|
+
@protocol = opts.delete(:protocol) { :ctap2 }
|
|
39
|
+
@transport = opts.delete(:transport) { :usb }
|
|
40
|
+
@resident_key = opts.delete(:resident_key) { false }
|
|
41
|
+
@user_verification = opts.delete(:user_verification) { false }
|
|
42
|
+
@user_consenting = opts.delete(:user_consenting) { true }
|
|
43
|
+
@user_verified = opts.delete(:user_verified) { false }
|
|
44
|
+
|
|
45
|
+
raise ArgumentError, "Invalid arguments: #{opts.keys}" unless opts.empty?
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
#
|
|
@@ -111,7 +111,7 @@ module Selenium
|
|
|
111
111
|
return {} if message.empty?
|
|
112
112
|
|
|
113
113
|
message = JSON.parse(message)
|
|
114
|
-
messages[message[
|
|
114
|
+
messages[message['id']] = message
|
|
115
115
|
WebDriver.logger.debug "WebSocket <- #{message}"[...MAX_LOG_MESSAGE_SIZE]
|
|
116
116
|
|
|
117
117
|
message
|
|
@@ -159,7 +159,6 @@ module Selenium
|
|
|
159
159
|
@id ||= 0
|
|
160
160
|
@id += 1
|
|
161
161
|
end
|
|
162
|
-
|
|
163
162
|
end # BiDi
|
|
164
163
|
end # WebDriver
|
|
165
164
|
end # Selenium
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
23
|
class ConsoleEvent
|
|
24
|
-
|
|
25
24
|
attr_accessor :type, :timestamp, :args
|
|
26
25
|
|
|
27
26
|
def initialize(type:, timestamp:, args:)
|
|
@@ -31,7 +30,6 @@ module Selenium
|
|
|
31
30
|
arg.key?('value') ? arg['value'] : arg
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
|
-
|
|
35
33
|
end # ConsoleEvent
|
|
36
34
|
end # DevTools
|
|
37
35
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
23
|
class ExceptionEvent
|
|
24
|
-
|
|
25
24
|
attr_accessor :description, :timestamp, :stacktrace
|
|
26
25
|
|
|
27
26
|
def initialize(description:, timestamp:, stacktrace:)
|
|
@@ -29,7 +28,6 @@ module Selenium
|
|
|
29
28
|
@timestamp = Time.at(timestamp / 1000)
|
|
30
29
|
@stacktrace = stacktrace
|
|
31
30
|
end
|
|
32
|
-
|
|
33
31
|
end # ExceptionEvent
|
|
34
32
|
end # DevTools
|
|
35
33
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
23
|
class MutationEvent
|
|
24
|
-
|
|
25
24
|
attr_accessor :element, :attribute_name, :current_value, :old_value
|
|
26
25
|
|
|
27
26
|
def initialize(element:, attribute_name:, current_value:, old_value:)
|
|
@@ -30,7 +29,6 @@ module Selenium
|
|
|
30
29
|
@current_value = current_value
|
|
31
30
|
@old_value = old_value
|
|
32
31
|
end
|
|
33
|
-
|
|
34
32
|
end # MutationEvent
|
|
35
33
|
end # DevTools
|
|
36
34
|
end # WebDriver
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
module Selenium
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
|
-
|
|
24
23
|
#
|
|
25
24
|
# Wraps the network request/response interception, providing
|
|
26
25
|
# thread-safety guarantees and handling special cases such as browser
|
|
@@ -31,14 +30,13 @@ module Selenium
|
|
|
31
30
|
#
|
|
32
31
|
|
|
33
32
|
class NetworkInterceptor
|
|
34
|
-
|
|
35
33
|
# CDP fails to get body on certain responses (301) and raises:
|
|
36
34
|
# "Can only get response body on requests captured after headers received."
|
|
37
|
-
CANNOT_GET_BODY_ON_REDIRECT_ERROR_CODE =
|
|
35
|
+
CANNOT_GET_BODY_ON_REDIRECT_ERROR_CODE = '-32000'
|
|
38
36
|
|
|
39
37
|
# CDP fails to operate with intercepted requests.
|
|
40
38
|
# Typical reason is browser cancelling intercepted requests/responses.
|
|
41
|
-
INVALID_INTERCEPTION_ID_ERROR_CODE =
|
|
39
|
+
INVALID_INTERCEPTION_ID_ERROR_CODE = '-32602'
|
|
42
40
|
|
|
43
41
|
def initialize(devtools)
|
|
44
42
|
@devtools = devtools
|
|
@@ -129,7 +127,7 @@ module Selenium
|
|
|
129
127
|
def continue_request(id)
|
|
130
128
|
devtools.fetch.continue_request(request_id: id)
|
|
131
129
|
end
|
|
132
|
-
|
|
130
|
+
alias continue_response continue_request
|
|
133
131
|
|
|
134
132
|
def mutate_request(request)
|
|
135
133
|
devtools.fetch.continue_request(
|
|
@@ -169,7 +167,6 @@ module Selenium
|
|
|
169
167
|
def cancelled?(network_id)
|
|
170
168
|
lock.synchronize { !!cancelled_requests.delete(network_id) }
|
|
171
169
|
end
|
|
172
|
-
|
|
173
170
|
end # NetworkInterceptor
|
|
174
171
|
end # DevTools
|
|
175
172
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
23
|
class PinnedScript
|
|
24
|
-
|
|
25
24
|
attr_accessor :key, :devtools_identifier, :script
|
|
26
25
|
|
|
27
26
|
def initialize(script)
|
|
@@ -52,7 +51,6 @@ module Selenium
|
|
|
52
51
|
def remove
|
|
53
52
|
"__webdriver_#{key} = undefined"
|
|
54
53
|
end
|
|
55
|
-
|
|
56
54
|
end # PinnedScript
|
|
57
55
|
end # DevTools
|
|
58
56
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
23
|
class Request
|
|
24
|
-
|
|
25
24
|
attr_accessor :url, :method, :headers, :post_data
|
|
26
25
|
attr_reader :id
|
|
27
26
|
|
|
@@ -60,7 +59,6 @@ module Selenium
|
|
|
60
59
|
def inspect
|
|
61
60
|
%(#<#{self.class.name} @id="#{id}" @method="#{method}" @url="#{url}")
|
|
62
61
|
end
|
|
63
|
-
|
|
64
62
|
end # Request
|
|
65
63
|
end # DevTools
|
|
66
64
|
end # WebDriver
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class DevTools
|
|
23
23
|
class Response
|
|
24
|
-
|
|
25
24
|
attr_accessor :code, :body, :headers
|
|
26
25
|
attr_reader :id
|
|
27
26
|
|
|
@@ -59,7 +58,6 @@ module Selenium
|
|
|
59
58
|
def inspect
|
|
60
59
|
%(#<#{self.class.name} @id="#{id}" @code="#{code}")
|
|
61
60
|
end
|
|
62
|
-
|
|
63
61
|
end # Response
|
|
64
62
|
end # DevTools
|
|
65
63
|
end # WebDriver
|
|
@@ -17,18 +17,25 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/
|
|
20
|
+
require 'selenium/webdriver/chromium/driver'
|
|
21
21
|
|
|
22
22
|
module Selenium
|
|
23
23
|
module WebDriver
|
|
24
24
|
module Edge
|
|
25
|
-
|
|
26
25
|
#
|
|
27
26
|
# Driver implementation for Microsoft Edge.
|
|
28
27
|
# @api private
|
|
29
28
|
#
|
|
30
29
|
|
|
31
|
-
class Driver <
|
|
30
|
+
class Driver < Chromium::Driver
|
|
31
|
+
def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
|
|
32
|
+
raise ArgumentError, "Can't initialize #{self.class} with :url" if url
|
|
33
|
+
|
|
34
|
+
caps = process_options(options, capabilities)
|
|
35
|
+
url = service_url(service || Service.edge)
|
|
36
|
+
super(caps: caps, url: url, **opts)
|
|
37
|
+
end
|
|
38
|
+
|
|
32
39
|
def browser
|
|
33
40
|
:edge
|
|
34
41
|
end
|
|
@@ -38,6 +45,16 @@ module Selenium
|
|
|
38
45
|
def devtools_address
|
|
39
46
|
"http://#{capabilities['ms:edgeOptions']['debuggerAddress']}"
|
|
40
47
|
end
|
|
48
|
+
|
|
49
|
+
def process_options(options, capabilities)
|
|
50
|
+
if options && !options.is_a?(Options)
|
|
51
|
+
raise ArgumentError, ":options must be an instance of #{Options}"
|
|
52
|
+
elsif options.nil? && capabilities.nil?
|
|
53
|
+
options = Options.new
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
super(options, capabilities)
|
|
57
|
+
end
|
|
41
58
|
end # Driver
|
|
42
59
|
end # Edge
|
|
43
60
|
end # WebDriver
|
|
@@ -17,14 +17,13 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/
|
|
20
|
+
require 'selenium/webdriver/chromium/features'
|
|
21
21
|
|
|
22
22
|
module Selenium
|
|
23
23
|
module WebDriver
|
|
24
24
|
module Edge
|
|
25
25
|
module Features
|
|
26
|
-
|
|
27
|
-
include WebDriver::Chrome::Features
|
|
26
|
+
include WebDriver::Chromium::Features
|
|
28
27
|
|
|
29
28
|
EDGE_COMMANDS = {
|
|
30
29
|
get_cast_sinks: [:get, 'session/:session_id/ms/cast/get_sinks'],
|
|
@@ -37,7 +36,7 @@ module Selenium
|
|
|
37
36
|
}.freeze
|
|
38
37
|
|
|
39
38
|
def commands(command)
|
|
40
|
-
EDGE_COMMANDS[command] ||
|
|
39
|
+
EDGE_COMMANDS[command] || CHROMIUM_COMMANDS[command] || self.class::COMMANDS[command]
|
|
41
40
|
end
|
|
42
41
|
end # Bridge
|
|
43
42
|
end # Edge
|
|
@@ -17,23 +17,21 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/
|
|
20
|
+
require 'selenium/webdriver/chromium/options'
|
|
21
21
|
|
|
22
22
|
module Selenium
|
|
23
23
|
module WebDriver
|
|
24
24
|
module Edge
|
|
25
|
-
class Options <
|
|
25
|
+
class Options < Chromium::Options
|
|
26
26
|
KEY = 'ms:edgeOptions'
|
|
27
27
|
BROWSER = 'MicrosoftEdge'
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
private
|
|
30
30
|
|
|
31
31
|
def enable_logging(browser_options)
|
|
32
32
|
browser_options['ms:loggingPrefs'] = @logging_prefs
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
private
|
|
36
|
-
|
|
37
35
|
def binary_path
|
|
38
36
|
Edge.path
|
|
39
37
|
end
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/
|
|
20
|
+
require 'selenium/webdriver/chromium/profile'
|
|
21
21
|
|
|
22
22
|
module Selenium
|
|
23
23
|
module WebDriver
|
|
@@ -26,7 +26,7 @@ module Selenium
|
|
|
26
26
|
# @private
|
|
27
27
|
#
|
|
28
28
|
|
|
29
|
-
class Profile <
|
|
29
|
+
class Profile < Chromium::Profile
|
|
30
30
|
end # Profile
|
|
31
31
|
end # Edge
|
|
32
32
|
end # WebDriver
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/
|
|
20
|
+
require 'selenium/webdriver/chromium/service'
|
|
21
21
|
|
|
22
22
|
module Selenium
|
|
23
23
|
module WebDriver
|
|
24
24
|
module Edge
|
|
25
|
-
class Service <
|
|
25
|
+
class Service < Chromium::Service
|
|
26
26
|
DEFAULT_PORT = 9515
|
|
27
27
|
EXECUTABLE = 'msedgedriver'
|
|
28
28
|
MISSING_TEXT = <<~ERROR
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
module Selenium
|
|
21
21
|
module WebDriver
|
|
22
22
|
module Firefox
|
|
23
|
-
|
|
24
23
|
#
|
|
25
24
|
# Driver implementation for Firefox using GeckoDriver.
|
|
26
25
|
# @api private
|
|
@@ -37,6 +36,14 @@ module Selenium
|
|
|
37
36
|
DriverExtensions::HasWebStorage,
|
|
38
37
|
DriverExtensions::PrintsPage].freeze
|
|
39
38
|
|
|
39
|
+
def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
|
|
40
|
+
raise ArgumentError, "Can't initialize #{self.class} with :url" if url
|
|
41
|
+
|
|
42
|
+
caps = process_options(options, capabilities)
|
|
43
|
+
url = service_url(service || Service.firefox)
|
|
44
|
+
super(caps: caps, url: url, **opts)
|
|
45
|
+
end
|
|
46
|
+
|
|
40
47
|
def browser
|
|
41
48
|
:firefox
|
|
42
49
|
end
|
|
@@ -45,7 +52,7 @@ module Selenium
|
|
|
45
52
|
|
|
46
53
|
def devtools_url
|
|
47
54
|
if capabilities['moz:debuggerAddress'].nil?
|
|
48
|
-
raise(Error::WebDriverError,
|
|
55
|
+
raise(Error::WebDriverError, 'DevTools is not supported by this version of Firefox; use v85 or higher')
|
|
49
56
|
end
|
|
50
57
|
|
|
51
58
|
uri = URI("http://#{capabilities['moz:debuggerAddress']}")
|
|
@@ -57,6 +64,16 @@ module Selenium
|
|
|
57
64
|
def devtools_version
|
|
58
65
|
Firefox::DEVTOOLS_VERSION
|
|
59
66
|
end
|
|
67
|
+
|
|
68
|
+
def process_options(options, capabilities)
|
|
69
|
+
if options && !options.is_a?(Options)
|
|
70
|
+
raise ArgumentError, ":options must be an instance of #{Options}"
|
|
71
|
+
elsif options.nil? && capabilities.nil?
|
|
72
|
+
options = Options.new
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
super(options, capabilities)
|
|
76
|
+
end
|
|
60
77
|
end # Driver
|
|
61
78
|
end # Firefox
|
|
62
79
|
end # WebDriver
|
|
@@ -108,6 +108,9 @@ module Selenium
|
|
|
108
108
|
#
|
|
109
109
|
|
|
110
110
|
def headless!
|
|
111
|
+
WebDriver.logger.deprecate('`Options#headless!`',
|
|
112
|
+
"`Options#add_argument('-headless')`",
|
|
113
|
+
id: :headless)
|
|
111
114
|
add_argument '-headless'
|
|
112
115
|
end
|
|
113
116
|
|
|
@@ -178,7 +181,7 @@ module Selenium
|
|
|
178
181
|
end
|
|
179
182
|
|
|
180
183
|
def camelize?(key)
|
|
181
|
-
key !=
|
|
184
|
+
key != 'prefs'
|
|
182
185
|
end
|
|
183
186
|
end # Options
|
|
184
187
|
end # Firefox
|