selenium-webdriver 3.141.0 → 3.142.7
Sign up to get free protection for your applications and to get access to all the features.
- 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
|
@@ -28,18 +30,9 @@ module Selenium
|
|
28
30
|
include DriverExtensions::TakesScreenshot
|
29
31
|
|
30
32
|
def initialize(opts = {})
|
31
|
-
opts[:desired_capabilities] ||= Remote::
|
32
|
-
|
33
|
-
unless opts.key?(:url)
|
34
|
-
driver_path = opts.delete(:driver_path) || Edge.driver_path
|
35
|
-
driver_opts = opts.delete(:driver_opts) || {}
|
36
|
-
port = opts.delete(:port) || Service::DEFAULT_PORT
|
33
|
+
opts[:desired_capabilities] ||= Remote::Capabilities.edge
|
37
34
|
|
38
|
-
|
39
|
-
@service.host = 'localhost' if @service.host == '127.0.0.1'
|
40
|
-
@service.start
|
41
|
-
opts[:url] = @service.uri
|
42
|
-
end
|
35
|
+
opts[:url] ||= service_url(opts)
|
43
36
|
|
44
37
|
listener = opts.delete(:listener)
|
45
38
|
|
@@ -51,7 +44,7 @@ module Selenium
|
|
51
44
|
capabilities = bridge.create_session(desired_capabilities)
|
52
45
|
|
53
46
|
WebDriver.logger.info 'Forcing W3C dialect.'
|
54
|
-
@bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
|
47
|
+
@bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
|
55
48
|
@bridge.extend Edge::Bridge
|
56
49
|
|
57
50
|
super(@bridge, listener: listener)
|
@@ -64,7 +57,7 @@ module Selenium
|
|
64
57
|
def quit
|
65
58
|
super
|
66
59
|
ensure
|
67
|
-
@service
|
60
|
+
@service&.stop
|
68
61
|
end
|
69
62
|
|
70
63
|
end # Driver
|
@@ -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
|
@@ -55,6 +57,7 @@ module Selenium
|
|
55
57
|
|
56
58
|
def add_extension_path(path)
|
57
59
|
raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.directory?(path)
|
60
|
+
|
58
61
|
@extension_paths << path
|
59
62
|
end
|
60
63
|
|
@@ -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,27 +25,21 @@ module Selenium
|
|
23
25
|
#
|
24
26
|
|
25
27
|
class Service < WebDriver::Service
|
26
|
-
|
27
|
-
@executable = 'MicrosoftWebDriver'
|
28
|
-
@missing_text =
|
28
|
+
@default_port = 17556
|
29
|
+
@executable = 'MicrosoftWebDriver'
|
30
|
+
@missing_text = <<~ERROR
|
29
31
|
Unable to find MicrosoftWebDriver. Please download the server from
|
30
32
|
https://www.microsoft.com/en-us/download/details.aspx?id=48212 and place it somewhere on your PATH.
|
31
33
|
More info at https://github.com/SeleniumHQ/selenium/wiki/MicrosoftWebDriver.
|
32
34
|
ERROR
|
35
|
+
@shutdown_supported = true
|
33
36
|
|
34
37
|
private
|
35
38
|
|
36
|
-
|
37
|
-
@process = build_process(@executable_path, "--port=#{@port}", *@extra_args)
|
38
|
-
@process.start
|
39
|
-
end
|
40
|
-
|
41
|
-
def cannot_connect_error_text
|
42
|
-
"unable to connect to MicrosoftWebDriver #{@host}:#{@port}"
|
43
|
-
end
|
44
|
-
|
39
|
+
# Note: This processing is deprecated
|
45
40
|
def extract_service_args(driver_opts)
|
46
41
|
driver_args = super
|
42
|
+
driver_opts = driver_opts.dup
|
47
43
|
driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key? :host
|
48
44
|
driver_args << "--package=#{driver_opts[:package]}" if driver_opts.key? :package
|
49
45
|
driver_args << "--silent" if driver_opts[:silent] == true
|
@@ -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
|
@@ -20,19 +22,23 @@ require 'net/http'
|
|
20
22
|
require 'selenium/webdriver/edge/bridge'
|
21
23
|
require 'selenium/webdriver/edge/driver'
|
22
24
|
require 'selenium/webdriver/edge/options'
|
23
|
-
require 'selenium/webdriver/edge/service'
|
24
25
|
|
25
26
|
module Selenium
|
26
27
|
module WebDriver
|
27
28
|
module Edge
|
28
29
|
def self.driver_path=(path)
|
29
|
-
|
30
|
-
|
30
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Edge#driver_path=',
|
31
|
+
'Selenium::WebDriver::Edge::Service#driver_path='
|
32
|
+
Selenium::WebDriver::Edge::Service.driver_path = path
|
31
33
|
end
|
32
34
|
|
33
|
-
def self.driver_path
|
34
|
-
|
35
|
+
def self.driver_path
|
36
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Edge#driver_path',
|
37
|
+
'Selenium::WebDriver::Edge::Service#driver_path'
|
38
|
+
Selenium::WebDriver::Edge::Service.driver_path
|
35
39
|
end
|
36
40
|
end # Edge
|
37
41
|
end # WebDriver
|
38
42
|
end # Selenium
|
43
|
+
|
44
|
+
require 'selenium/webdriver/edge/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
|
@@ -20,7 +22,7 @@ module Selenium
|
|
20
22
|
module Firefox
|
21
23
|
# @api private
|
22
24
|
class Binary
|
23
|
-
NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'
|
25
|
+
NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'
|
24
26
|
NO_FOCUS_LIBRARIES = [
|
25
27
|
["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/amd64/#{NO_FOCUS_LIBRARY_NAME}",
|
26
28
|
"amd64/#{NO_FOCUS_LIBRARY_NAME}"],
|
@@ -35,7 +37,7 @@ module Selenium
|
|
35
37
|
if Platform.cygwin?
|
36
38
|
profile_path = Platform.cygwin_path(profile_path, windows: true)
|
37
39
|
elsif Platform.windows?
|
38
|
-
profile_path =
|
40
|
+
profile_path = Platform.windows_path(profile_path)
|
39
41
|
end
|
40
42
|
|
41
43
|
ENV['XRE_CONSOLE_LOG'] = profile.log_file if profile.log_file
|
@@ -44,15 +46,14 @@ module Selenium
|
|
44
46
|
ENV['MOZ_CRASHREPORTER_DISABLE'] = '1' # disable breakpad
|
45
47
|
ENV['NO_EM_RESTART'] = '1' # prevent the binary from detaching from the console
|
46
48
|
|
47
|
-
if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
|
48
|
-
modify_link_library_path profile_path
|
49
|
-
end
|
49
|
+
modify_link_library_path profile_path if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
|
50
50
|
|
51
51
|
execute(*args)
|
52
52
|
end
|
53
53
|
|
54
54
|
def quit
|
55
55
|
return unless @process
|
56
|
+
|
56
57
|
@process.poll_for_exit QUIT_TIMEOUT
|
57
58
|
rescue ChildProcess::TimeoutError
|
58
59
|
# ok, force quit
|
@@ -126,11 +127,11 @@ module Selenium
|
|
126
127
|
raise Error::WebDriverError, "unknown platform: #{Platform.os}"
|
127
128
|
end
|
128
129
|
|
129
|
-
@path = Platform.cygwin_path(@path) if Platform.cygwin?
|
130
|
+
@path = Platform.cygwin_path(@path, windows: true) if Platform.cygwin?
|
130
131
|
|
131
132
|
unless File.file?(@path.to_s)
|
132
|
-
error = "Could not find Firefox binary (os=#{Platform.os}). "
|
133
|
-
|
133
|
+
error = "Could not find Firefox binary (os=#{Platform.os}). " \
|
134
|
+
"Make sure Firefox is installed or set the path manually with #{self}.path="
|
134
135
|
raise Error::WebDriverError, error
|
135
136
|
end
|
136
137
|
|
@@ -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,12 +25,10 @@ module Selenium
|
|
23
25
|
#
|
24
26
|
|
25
27
|
class Extension
|
26
|
-
NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'
|
28
|
+
NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'
|
27
29
|
|
28
30
|
def initialize(path)
|
29
|
-
unless File.exist?(path)
|
30
|
-
raise Error::WebDriverError, "could not find extension at #{path.inspect}"
|
31
|
-
end
|
31
|
+
raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.exist?(path)
|
32
32
|
|
33
33
|
@path = path
|
34
34
|
@should_reap_root = false
|
@@ -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
|
@@ -82,6 +84,7 @@ module Selenium
|
|
82
84
|
poller = SocketPoller.new(@host, @port, STABLE_CONNECTION_TIMEOUT)
|
83
85
|
|
84
86
|
return if poller.connected?
|
87
|
+
|
85
88
|
@binary.quit
|
86
89
|
error = "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds (#{@host}:#{@port})"
|
87
90
|
raise Error::WebDriverError, error
|
@@ -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
|
@@ -28,8 +30,10 @@ module Selenium
|
|
28
30
|
class Driver < WebDriver::Driver
|
29
31
|
include DriverExtensions::TakesScreenshot
|
30
32
|
|
31
|
-
def initialize(opts = {})
|
32
|
-
|
33
|
+
def initialize(opts = {}) # rubocop:disable Metrics/AbcSize
|
34
|
+
WebDriver.logger.deprecate 'Selenium support for legacy Firefox', 'Firefox via marionette'
|
35
|
+
|
36
|
+
opts[:desired_capabilities] ||= Remote::Capabilities.firefox_legacy
|
33
37
|
|
34
38
|
if opts.key? :proxy
|
35
39
|
WebDriver.logger.deprecate ':proxy', "Selenium::WebDriver::Remote::Capabilities.firefox(proxy: #{opts[:proxy]})"
|
@@ -56,7 +60,7 @@ module Selenium
|
|
56
60
|
begin
|
57
61
|
super(@bridge, listener: listener)
|
58
62
|
rescue
|
59
|
-
@launcher
|
63
|
+
@launcher&.quit
|
60
64
|
raise
|
61
65
|
end
|
62
66
|
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
|
@@ -22,8 +24,8 @@ module Selenium
|
|
22
24
|
module Bridge
|
23
25
|
|
24
26
|
COMMANDS = {
|
25
|
-
install_addon: [:post, 'session/:session_id/moz/addon/install'
|
26
|
-
uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall'
|
27
|
+
install_addon: [:post, 'session/:session_id/moz/addon/install'],
|
28
|
+
uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall']
|
27
29
|
}.freeze
|
28
30
|
|
29
31
|
def commands(command)
|
@@ -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
|
@@ -33,22 +35,14 @@ module Selenium
|
|
33
35
|
def initialize(opts = {})
|
34
36
|
opts[:desired_capabilities] = create_capabilities(opts)
|
35
37
|
|
36
|
-
|
37
|
-
driver_path = opts.delete(:driver_path) || Firefox.driver_path
|
38
|
-
driver_opts = opts.delete(:driver_opts) || {}
|
39
|
-
port = opts.delete(:port) || Service::DEFAULT_PORT
|
40
|
-
|
41
|
-
@service = Service.new(driver_path, port, driver_opts)
|
42
|
-
@service.start
|
43
|
-
opts[:url] = @service.uri
|
44
|
-
end
|
38
|
+
opts[:url] ||= service_url(opts)
|
45
39
|
|
46
40
|
listener = opts.delete(:listener)
|
47
41
|
WebDriver.logger.info 'Skipping handshake as we know it is W3C.'
|
48
42
|
desired_capabilities = opts.delete(:desired_capabilities)
|
49
43
|
bridge = Remote::Bridge.new(opts)
|
50
44
|
capabilities = bridge.create_session(desired_capabilities)
|
51
|
-
@bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
|
45
|
+
@bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
|
52
46
|
@bridge.extend Marionette::Bridge
|
53
47
|
|
54
48
|
super(@bridge, listener: listener)
|
@@ -61,13 +55,13 @@ module Selenium
|
|
61
55
|
def quit
|
62
56
|
super
|
63
57
|
ensure
|
64
|
-
@service
|
58
|
+
@service&.stop
|
65
59
|
end
|
66
60
|
|
67
61
|
private
|
68
62
|
|
69
63
|
def create_capabilities(opts)
|
70
|
-
caps = opts.delete(:desired_capabilities) { Remote::
|
64
|
+
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
|
71
65
|
options = opts.delete(:options) { Options.new }
|
72
66
|
|
73
67
|
firefox_options = opts.delete(:firefox_options)
|
@@ -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,11 +20,11 @@
|
|
18
20
|
module Selenium
|
19
21
|
module WebDriver
|
20
22
|
module Firefox
|
21
|
-
class Options
|
23
|
+
class Options < WebDriver::Common::Options
|
22
24
|
attr_reader :args, :prefs, :options, :profile
|
23
25
|
attr_accessor :binary, :log_level
|
24
26
|
|
25
|
-
KEY = 'moz:firefoxOptions'
|
27
|
+
KEY = 'moz:firefoxOptions'
|
26
28
|
|
27
29
|
#
|
28
30
|
# Create a new Options instance, only for W3C-capable versions of Firefox.
|
@@ -43,7 +45,7 @@ module Selenium
|
|
43
45
|
def initialize(**opts)
|
44
46
|
@args = Set.new(opts.delete(:args) || [])
|
45
47
|
@binary = opts.delete(:binary)
|
46
|
-
@profile = opts.delete(:profile)
|
48
|
+
@profile = process_profile(opts.delete(:profile))
|
47
49
|
@log_level = opts.delete(:log_level)
|
48
50
|
@prefs = opts.delete(:prefs) || {}
|
49
51
|
@options = opts.delete(:options) || {}
|
@@ -121,11 +123,7 @@ module Selenium
|
|
121
123
|
#
|
122
124
|
|
123
125
|
def profile=(profile)
|
124
|
-
@profile =
|
125
|
-
profile
|
126
|
-
else
|
127
|
-
Profile.from_name(profile)
|
128
|
-
end
|
126
|
+
@profile = process_profile(profile)
|
129
127
|
end
|
130
128
|
|
131
129
|
#
|
@@ -141,7 +139,22 @@ module Selenium
|
|
141
139
|
opts[:prefs] = @prefs unless @prefs.empty?
|
142
140
|
opts[:log] = {level: @log_level} if @log_level
|
143
141
|
|
144
|
-
{KEY => opts}
|
142
|
+
{KEY => generate_as_json(opts)}
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def process_profile(profile)
|
148
|
+
return unless profile
|
149
|
+
|
150
|
+
case profile
|
151
|
+
when Profile
|
152
|
+
profile
|
153
|
+
when String
|
154
|
+
Profile.from_name(profile)
|
155
|
+
else
|
156
|
+
raise Error::WebDriverError, "don't know how to handle profile: #{profile.inspect}"
|
157
|
+
end
|
145
158
|
end
|
146
159
|
end # Options
|
147
160
|
end # Firefox
|
@@ -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
|
@@ -42,6 +44,7 @@ module Selenium
|
|
42
44
|
def from_name(name)
|
43
45
|
profile = ini[name]
|
44
46
|
return profile if profile
|
47
|
+
|
45
48
|
raise Error::WebDriverError, "unable to find profile named: #{name.inspect}"
|
46
49
|
end
|
47
50
|
|
@@ -131,6 +134,7 @@ module Selenium
|
|
131
134
|
|
132
135
|
def add_webdriver_extension
|
133
136
|
return if @extensions.key?(:webdriver)
|
137
|
+
|
134
138
|
add_extension(WEBDRIVER_EXTENSION_PATH, :webdriver)
|
135
139
|
end
|
136
140
|
|
@@ -163,9 +167,7 @@ module Selenium
|
|
163
167
|
end
|
164
168
|
|
165
169
|
def proxy=(proxy)
|
166
|
-
unless proxy.is_a? Proxy
|
167
|
-
raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
|
168
|
-
end
|
170
|
+
raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}" unless proxy.is_a? Proxy
|
169
171
|
|
170
172
|
case proxy.type
|
171
173
|
when :manual
|
@@ -176,11 +178,7 @@ module Selenium
|
|
176
178
|
set_manual_proxy_preference 'ssl', proxy.ssl
|
177
179
|
set_manual_proxy_preference 'socks', proxy.socks
|
178
180
|
|
179
|
-
self['network.proxy.no_proxies_on'] =
|
180
|
-
proxy.no_proxy
|
181
|
-
else
|
182
|
-
''
|
183
|
-
end
|
181
|
+
self['network.proxy.no_proxies_on'] = proxy.no_proxy || ''
|
184
182
|
when :pac
|
185
183
|
self['network.proxy.type'] = 2
|
186
184
|
self['network.proxy.autoconfig_url'] = proxy.pac
|
@@ -259,6 +257,7 @@ module Selenium
|
|
259
257
|
|
260
258
|
File.read(path).split("\n").each do |line|
|
261
259
|
next unless line =~ /user_pref\("([^"]+)"\s*,\s*(.+?)\);/
|
260
|
+
|
262
261
|
key = Regexp.last_match(1).strip
|
263
262
|
value = Regexp.last_match(2).strip
|
264
263
|
|
@@ -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
|
@@ -63,6 +65,7 @@ module Selenium
|
|
63
65
|
|
64
66
|
def path_for(name, is_relative, path)
|
65
67
|
return unless [name, path].any?
|
68
|
+
|
66
69
|
is_relative ? File.join(Util.app_data_path, path) : path
|
67
70
|
end
|
68
71
|
end # ProfilesIni
|
@@ -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,34 +25,21 @@ module Selenium
|
|
23
25
|
#
|
24
26
|
|
25
27
|
class Service < WebDriver::Service
|
26
|
-
|
27
|
-
@executable = 'geckodriver'
|
28
|
-
@missing_text =
|
28
|
+
@default_port = 4444
|
29
|
+
@executable = 'geckodriver'
|
30
|
+
@missing_text = <<~ERROR
|
29
31
|
Unable to find Mozilla geckodriver. Please download the server from
|
30
32
|
https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH.
|
31
33
|
More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.
|
32
34
|
ERROR
|
33
|
-
|
34
|
-
def stop
|
35
|
-
stop_process
|
36
|
-
end
|
35
|
+
@shutdown_supported = false
|
37
36
|
|
38
37
|
private
|
39
38
|
|
40
|
-
|
41
|
-
@process = build_process(@executable_path,
|
42
|
-
"--binary=#{Firefox::Binary.path}",
|
43
|
-
"--port=#{@port}",
|
44
|
-
*@extra_args)
|
45
|
-
@process.start
|
46
|
-
end
|
47
|
-
|
48
|
-
def cannot_connect_error_text
|
49
|
-
"unable to connect to Mozilla geckodriver #{@host}:#{@port}"
|
50
|
-
end
|
51
|
-
|
39
|
+
# Note: This processing is deprecated
|
52
40
|
def extract_service_args(driver_opts)
|
53
41
|
driver_args = super
|
42
|
+
driver_opts = driver_opts.dup
|
54
43
|
driver_args << "--binary=#{driver_opts[:binary]}" if driver_opts.key?(:binary)
|
55
44
|
driver_args << "--log=#{driver_opts[:log]}" if driver_opts.key?(:log)
|
56
45
|
driver_args << "--marionette-port=#{driver_opts[:marionette_port]}" if driver_opts.key?(:marionette_port)
|
@@ -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,6 @@ require 'selenium/webdriver/firefox/legacy/driver'
|
|
32
34
|
require 'selenium/webdriver/firefox/marionette/bridge'
|
33
35
|
require 'selenium/webdriver/firefox/marionette/driver'
|
34
36
|
require 'selenium/webdriver/firefox/options'
|
35
|
-
require 'selenium/webdriver/firefox/service'
|
36
37
|
|
37
38
|
module Selenium
|
38
39
|
module WebDriver
|
@@ -44,12 +45,15 @@ module Selenium
|
|
44
45
|
DEFAULT_LOAD_NO_FOCUS_LIB = false
|
45
46
|
|
46
47
|
def self.driver_path=(path)
|
47
|
-
|
48
|
-
|
48
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path=',
|
49
|
+
'Selenium::WebDriver::Firefox::Service#driver_path='
|
50
|
+
Selenium::WebDriver::Firefox::Service.driver_path = path
|
49
51
|
end
|
50
52
|
|
51
53
|
def self.driver_path
|
52
|
-
|
54
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path',
|
55
|
+
'Selenium::WebDriver::Firefox::Service#driver_path'
|
56
|
+
Selenium::WebDriver::Firefox::Service.driver_path
|
53
57
|
end
|
54
58
|
|
55
59
|
def self.path=(path)
|
@@ -58,3 +62,5 @@ module Selenium
|
|
58
62
|
end # Firefox
|
59
63
|
end # WebDriver
|
60
64
|
end # Selenium
|
65
|
+
|
66
|
+
require 'selenium/webdriver/firefox/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
|
@@ -32,18 +34,10 @@ module Selenium
|
|
32
34
|
def initialize(opts = {})
|
33
35
|
opts[:desired_capabilities] = create_capabilities(opts)
|
34
36
|
|
35
|
-
|
36
|
-
driver_path = opts.delete(:driver_path) || IE.driver_path
|
37
|
-
driver_opts = opts.delete(:driver_opts) || {}
|
38
|
-
port = opts.delete(:port) || Service::DEFAULT_PORT
|
39
|
-
|
40
|
-
@service = Service.new(driver_path, port, driver_opts)
|
41
|
-
@service.start
|
42
|
-
opts[:url] = @service.uri
|
43
|
-
end
|
37
|
+
opts[:url] ||= service_url(opts)
|
44
38
|
|
45
39
|
listener = opts.delete(:listener)
|
46
|
-
@bridge = Remote::Bridge.handshake(opts)
|
40
|
+
@bridge = Remote::Bridge.handshake(**opts)
|
47
41
|
super(@bridge, listener: listener)
|
48
42
|
end
|
49
43
|
|
@@ -54,7 +48,7 @@ module Selenium
|
|
54
48
|
def quit
|
55
49
|
super
|
56
50
|
ensure
|
57
|
-
@service
|
51
|
+
@service&.stop
|
58
52
|
end
|
59
53
|
|
60
54
|
private
|
@@ -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,8 +20,8 @@
|
|
18
20
|
module Selenium
|
19
21
|
module WebDriver
|
20
22
|
module IE
|
21
|
-
class Options
|
22
|
-
KEY = 'se:ieOptions'
|
23
|
+
class Options < WebDriver::Common::Options
|
24
|
+
KEY = 'se:ieOptions'
|
23
25
|
SCROLL_TOP = 0
|
24
26
|
SCROLL_BOTTOM = 1
|
25
27
|
CAPABILITIES = {
|
@@ -86,7 +88,7 @@ module Selenium
|
|
86
88
|
def initialize(**opts)
|
87
89
|
@args = Set.new(opts.delete(:args) || [])
|
88
90
|
@options = opts
|
89
|
-
@options[:native_events]
|
91
|
+
@options[:native_events] = true if @options[:native_events].nil?
|
90
92
|
end
|
91
93
|
|
92
94
|
#
|
@@ -128,7 +130,7 @@ module Selenium
|
|
128
130
|
opts['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
|
129
131
|
opts.merge!(@options)
|
130
132
|
|
131
|
-
{KEY => opts}
|
133
|
+
{KEY => generate_as_json(opts)}
|
132
134
|
end
|
133
135
|
end # Options
|
134
136
|
end # IE
|
@@ -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,27 +25,21 @@ module Selenium
|
|
23
25
|
#
|
24
26
|
|
25
27
|
class Service < WebDriver::Service
|
26
|
-
|
27
|
-
@executable = 'IEDriverServer'
|
28
|
-
@missing_text =
|
28
|
+
@default_port = 5555
|
29
|
+
@executable = 'IEDriverServer'
|
30
|
+
@missing_text = <<~ERROR
|
29
31
|
Unable to find IEDriverServer. Please download the server from
|
30
32
|
http://selenium-release.storage.googleapis.com/index.html and place it somewhere on your PATH.
|
31
33
|
More info at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver.
|
32
34
|
ERROR
|
35
|
+
@shutdown_supported = true
|
33
36
|
|
34
37
|
private
|
35
38
|
|
36
|
-
|
37
|
-
@process = build_process(@executable_path, "--port=#{@port}", *@extra_args)
|
38
|
-
@process.start
|
39
|
-
end
|
40
|
-
|
41
|
-
def cannot_connect_error_text
|
42
|
-
"unable to connect to IE server #{@host}:#{@port}"
|
43
|
-
end
|
44
|
-
|
39
|
+
# Note: This processing is deprecated
|
45
40
|
def extract_service_args(driver_opts)
|
46
41
|
driver_args = super
|
42
|
+
driver_opts = driver_opts.dup
|
47
43
|
driver_args << "--log-level=#{driver_opts.delete(:log_level).to_s.upcase}" if driver_opts.key?(:log_level)
|
48
44
|
driver_args << "--log-file=#{driver_opts.delete(:log_file)}" if driver_opts.key?(:log_file)
|
49
45
|
driver_args << "--implementation=#{driver_opts.delete(:implementation).to_s.upcase}" if driver_opts.key?(:implementation)
|