selenium-webdriver 2.45.0 → 3.142.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +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
@@ -0,0 +1,76 @@
|
|
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
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module Edge
|
23
|
+
module Bridge
|
24
|
+
|
25
|
+
def commands(command)
|
26
|
+
unsupported = %i[execute_script execute_async_script submit_element double_click
|
27
|
+
mouse_down mouse_up mouse_move_to click
|
28
|
+
send_keys_to_active_element get_window_handles get_current_window_handle
|
29
|
+
get_window_size set_window_size get_window_position set_window_position
|
30
|
+
maximize_window get_alert_text accept_alert dismiss_alert]
|
31
|
+
if unsupported.include? command
|
32
|
+
Remote::OSS::Bridge::COMMANDS[command]
|
33
|
+
else
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def send_keys_to_active_element(key)
|
39
|
+
execute :send_keys_to_active_element, {}, {value: key}
|
40
|
+
end
|
41
|
+
|
42
|
+
def window_handle
|
43
|
+
execute :get_current_window_handle
|
44
|
+
end
|
45
|
+
|
46
|
+
def window_size(handle = :current)
|
47
|
+
data = execute :get_window_size, window_handle: handle
|
48
|
+
|
49
|
+
Dimension.new data['width'], data['height']
|
50
|
+
end
|
51
|
+
|
52
|
+
def resize_window(width, height, handle = :current)
|
53
|
+
execute :set_window_size, {window_handle: handle},
|
54
|
+
{width: width,
|
55
|
+
height: height}
|
56
|
+
end
|
57
|
+
|
58
|
+
def window_position(handle = :current)
|
59
|
+
data = execute :get_window_position, window_handle: handle
|
60
|
+
|
61
|
+
Point.new data['x'], data['y']
|
62
|
+
end
|
63
|
+
|
64
|
+
def reposition_window(x, y, handle = :current)
|
65
|
+
execute :set_window_position, {window_handle: handle},
|
66
|
+
{x: x, y: y}
|
67
|
+
end
|
68
|
+
|
69
|
+
def maximize_window(handle = :current)
|
70
|
+
execute :maximize_window, window_handle: handle
|
71
|
+
end
|
72
|
+
|
73
|
+
end # Bridge
|
74
|
+
end # Edge
|
75
|
+
end # WebDriver
|
76
|
+
end # Selenium
|
@@ -0,0 +1,66 @@
|
|
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
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module Edge
|
23
|
+
|
24
|
+
#
|
25
|
+
# Driver implementation for Microsoft Edge.
|
26
|
+
# @api private
|
27
|
+
#
|
28
|
+
|
29
|
+
class Driver < WebDriver::Driver
|
30
|
+
include DriverExtensions::TakesScreenshot
|
31
|
+
|
32
|
+
def initialize(opts = {})
|
33
|
+
opts[:desired_capabilities] ||= Remote::Capabilities.edge
|
34
|
+
|
35
|
+
opts[:url] ||= service_url(opts)
|
36
|
+
|
37
|
+
listener = opts.delete(:listener)
|
38
|
+
|
39
|
+
# Edge is mostly using W3C dialect, but a request to
|
40
|
+
# create session responds with OSS-like body,
|
41
|
+
# so we need to force W3C implementation.
|
42
|
+
desired_capabilities = opts.delete(:desired_capabilities)
|
43
|
+
bridge = Remote::Bridge.new(opts)
|
44
|
+
capabilities = bridge.create_session(desired_capabilities)
|
45
|
+
|
46
|
+
WebDriver.logger.info 'Forcing W3C dialect.'
|
47
|
+
@bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
|
48
|
+
@bridge.extend Edge::Bridge
|
49
|
+
|
50
|
+
super(@bridge, listener: listener)
|
51
|
+
end
|
52
|
+
|
53
|
+
def browser
|
54
|
+
:edge
|
55
|
+
end
|
56
|
+
|
57
|
+
def quit
|
58
|
+
super
|
59
|
+
ensure
|
60
|
+
@service&.stop
|
61
|
+
end
|
62
|
+
|
63
|
+
end # Driver
|
64
|
+
end # Edge
|
65
|
+
end # WebDriver
|
66
|
+
end # Selenium
|
@@ -0,0 +1,80 @@
|
|
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
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module Edge
|
23
|
+
class Options
|
24
|
+
attr_accessor :in_private, :start_page
|
25
|
+
attr_reader :extension_paths
|
26
|
+
|
27
|
+
#
|
28
|
+
# Create a new Options instance for Edge.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# options = Selenium::WebDriver::Edge::Options.new(in_private: true)
|
32
|
+
# driver = Selenium::WebDriver.for :edge, options: options
|
33
|
+
#
|
34
|
+
# @param [Hash] opts the pre-defined options to create the Edge::Options with
|
35
|
+
# @option opts [Boolean] :in_private Start in private mode. Default is false
|
36
|
+
# @option opts [Array<String>] :extension_paths A list of full paths to extensions to install on startup
|
37
|
+
# @option opts [String] :start_page Default page to start with
|
38
|
+
#
|
39
|
+
# @see https://docs.microsoft.com/en-us/microsoft-edge/webdriver
|
40
|
+
#
|
41
|
+
|
42
|
+
def initialize(**opts)
|
43
|
+
@in_private = opts.delete(:in_private) || false
|
44
|
+
@extension_paths = opts.delete(:extension_paths) || []
|
45
|
+
@start_page = opts.delete(:start_page)
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Add an extension by local path.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# options = Selenium::WebDriver::Edge::Options.new
|
53
|
+
# options.add_extension_path('C:\path\to\extension')
|
54
|
+
#
|
55
|
+
# @param [String] path The local path to the extension folder
|
56
|
+
#
|
57
|
+
|
58
|
+
def add_extension_path(path)
|
59
|
+
raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.directory?(path)
|
60
|
+
|
61
|
+
@extension_paths << path
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# @api private
|
66
|
+
#
|
67
|
+
|
68
|
+
def as_json(*)
|
69
|
+
opts = {}
|
70
|
+
|
71
|
+
opts['ms:inPrivate'] = true if @in_private
|
72
|
+
opts['ms:extensionPaths'] = @extension_paths if @extension_paths.any?
|
73
|
+
opts['ms:startPage'] = @start_page if @start_page
|
74
|
+
|
75
|
+
opts
|
76
|
+
end
|
77
|
+
end # Options
|
78
|
+
end # Edge
|
79
|
+
end # WebDriver
|
80
|
+
end # Selenium
|
@@ -0,0 +1,52 @@
|
|
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
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module Edge
|
23
|
+
#
|
24
|
+
# @api private
|
25
|
+
#
|
26
|
+
|
27
|
+
class Service < WebDriver::Service
|
28
|
+
@default_port = 17556
|
29
|
+
@executable = 'MicrosoftWebDriver'
|
30
|
+
@missing_text = <<~ERROR
|
31
|
+
Unable to find MicrosoftWebDriver. Please download the server from
|
32
|
+
https://www.microsoft.com/en-us/download/details.aspx?id=48212 and place it somewhere on your PATH.
|
33
|
+
More info at https://github.com/SeleniumHQ/selenium/wiki/MicrosoftWebDriver.
|
34
|
+
ERROR
|
35
|
+
@shutdown_supported = true
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# Note: This processing is deprecated
|
40
|
+
def extract_service_args(driver_opts)
|
41
|
+
driver_args = super
|
42
|
+
driver_opts = driver_opts.dup
|
43
|
+
driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key? :host
|
44
|
+
driver_args << "--package=#{driver_opts[:package]}" if driver_opts.key? :package
|
45
|
+
driver_args << "--silent" if driver_opts[:silent] == true
|
46
|
+
driver_args << "--verbose" if driver_opts[:verbose] == true
|
47
|
+
driver_args
|
48
|
+
end
|
49
|
+
end # Service
|
50
|
+
end # Edge
|
51
|
+
end # WebDriver
|
52
|
+
end # Service
|
@@ -0,0 +1,44 @@
|
|
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
|
+
|
20
|
+
require 'net/http'
|
21
|
+
|
22
|
+
require 'selenium/webdriver/edge/bridge'
|
23
|
+
require 'selenium/webdriver/edge/driver'
|
24
|
+
require 'selenium/webdriver/edge/options'
|
25
|
+
|
26
|
+
module Selenium
|
27
|
+
module WebDriver
|
28
|
+
module Edge
|
29
|
+
def self.driver_path=(path)
|
30
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Edge#driver_path=',
|
31
|
+
'Selenium::WebDriver::Edge::Service#driver_path='
|
32
|
+
Selenium::WebDriver::Edge::Service.driver_path = path
|
33
|
+
end
|
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
|
39
|
+
end
|
40
|
+
end # Edge
|
41
|
+
end # WebDriver
|
42
|
+
end # Selenium
|
43
|
+
|
44
|
+
require 'selenium/webdriver/edge/service'
|
@@ -1,42 +1,59 @@
|
|
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 Firefox
|
4
|
-
|
5
23
|
# @api private
|
6
24
|
class Binary
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/x86/#{NO_FOCUS_LIBRARY_NAME}",
|
12
|
-
|
25
|
+
NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'
|
26
|
+
NO_FOCUS_LIBRARIES = [
|
27
|
+
["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/amd64/#{NO_FOCUS_LIBRARY_NAME}",
|
28
|
+
"amd64/#{NO_FOCUS_LIBRARY_NAME}"],
|
29
|
+
["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/x86/#{NO_FOCUS_LIBRARY_NAME}",
|
30
|
+
"x86/#{NO_FOCUS_LIBRARY_NAME}"]
|
31
|
+
].freeze
|
13
32
|
|
14
33
|
WAIT_TIMEOUT = 90
|
15
34
|
QUIT_TIMEOUT = 5
|
16
35
|
|
17
36
|
def start_with(profile, profile_path, *args)
|
18
37
|
if Platform.cygwin?
|
19
|
-
profile_path = Platform.cygwin_path(profile_path, :
|
38
|
+
profile_path = Platform.cygwin_path(profile_path, windows: true)
|
20
39
|
elsif Platform.windows?
|
21
|
-
profile_path =
|
40
|
+
profile_path = Platform.windows_path(profile_path)
|
22
41
|
end
|
23
42
|
|
24
|
-
ENV['XRE_CONSOLE_LOG']
|
25
|
-
ENV['XRE_PROFILE_PATH']
|
26
|
-
ENV['MOZ_NO_REMOTE']
|
43
|
+
ENV['XRE_CONSOLE_LOG'] = profile.log_file if profile.log_file
|
44
|
+
ENV['XRE_PROFILE_PATH'] = profile_path
|
45
|
+
ENV['MOZ_NO_REMOTE'] = '1' # able to launch multiple instances
|
27
46
|
ENV['MOZ_CRASHREPORTER_DISABLE'] = '1' # disable breakpad
|
28
|
-
ENV['NO_EM_RESTART']
|
47
|
+
ENV['NO_EM_RESTART'] = '1' # prevent the binary from detaching from the console
|
29
48
|
|
30
|
-
if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
|
31
|
-
modify_link_library_path profile_path
|
32
|
-
end
|
49
|
+
modify_link_library_path profile_path if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
|
33
50
|
|
34
51
|
execute(*args)
|
35
|
-
cope_with_mac_strangeness(args) if Platform.mac?
|
36
52
|
end
|
37
53
|
|
38
54
|
def quit
|
39
55
|
return unless @process
|
56
|
+
|
40
57
|
@process.poll_for_exit QUIT_TIMEOUT
|
41
58
|
rescue ChildProcess::TimeoutError
|
42
59
|
# ok, force quit
|
@@ -57,26 +74,12 @@ module Selenium
|
|
57
74
|
private
|
58
75
|
|
59
76
|
def execute(*extra_args)
|
60
|
-
args = [self.class.path,
|
77
|
+
args = [self.class.path, '-no-remote'] + extra_args
|
61
78
|
@process = ChildProcess.build(*args)
|
62
|
-
|
63
|
-
@process.start
|
64
|
-
end
|
65
|
-
|
66
|
-
def cope_with_mac_strangeness(args)
|
67
|
-
sleep 0.3
|
68
|
-
|
69
|
-
if @process.crashed?
|
70
|
-
# ok, trying a restart
|
71
|
-
sleep 7
|
72
|
-
execute(*args)
|
73
|
-
end
|
79
|
+
WebDriver.logger.debug("Executing Process #{args}")
|
74
80
|
|
75
|
-
|
76
|
-
|
77
|
-
if @process.crashed?
|
78
|
-
raise Error::WebDriverError, "unable to start Firefox cleanly, args: #{args.inspect}"
|
79
|
-
end
|
81
|
+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug?
|
82
|
+
@process.start
|
80
83
|
end
|
81
84
|
|
82
85
|
def modify_link_library_path(profile_path)
|
@@ -93,11 +96,10 @@ module Selenium
|
|
93
96
|
paths += ENV['LD_LIBRARY_PATH'].to_s.split(File::PATH_SEPARATOR)
|
94
97
|
|
95
98
|
ENV['LD_LIBRARY_PATH'] = paths.uniq.join(File::PATH_SEPARATOR)
|
96
|
-
ENV['LD_PRELOAD']
|
99
|
+
ENV['LD_PRELOAD'] = NO_FOCUS_LIBRARY_NAME
|
97
100
|
end
|
98
101
|
|
99
102
|
class << self
|
100
|
-
|
101
103
|
#
|
102
104
|
# @api private
|
103
105
|
#
|
@@ -109,6 +111,10 @@ module Selenium
|
|
109
111
|
@path = path
|
110
112
|
end
|
111
113
|
|
114
|
+
def reset_path!
|
115
|
+
@path = nil
|
116
|
+
end
|
117
|
+
|
112
118
|
def path
|
113
119
|
@path ||= case Platform.os
|
114
120
|
when :macosx
|
@@ -116,29 +122,47 @@ module Selenium
|
|
116
122
|
when :windows
|
117
123
|
windows_path
|
118
124
|
when :linux, :unix
|
119
|
-
Platform.find_binary(
|
125
|
+
Platform.find_binary('firefox3', 'firefox2', 'firefox') || '/usr/bin/firefox'
|
120
126
|
else
|
121
127
|
raise Error::WebDriverError, "unknown platform: #{Platform.os}"
|
122
128
|
end
|
123
129
|
|
124
|
-
@path = Platform.cygwin_path(@path) if Platform.cygwin?
|
130
|
+
@path = Platform.cygwin_path(@path, windows: true) if Platform.cygwin?
|
125
131
|
|
126
132
|
unless File.file?(@path.to_s)
|
127
|
-
|
133
|
+
error = "Could not find Firefox binary (os=#{Platform.os}). " \
|
134
|
+
"Make sure Firefox is installed or set the path manually with #{self}.path="
|
135
|
+
raise Error::WebDriverError, error
|
128
136
|
end
|
129
137
|
|
130
138
|
@path
|
131
139
|
end
|
132
140
|
|
141
|
+
def version
|
142
|
+
@version = case Platform.os
|
143
|
+
when :macosx
|
144
|
+
`#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
|
145
|
+
when :windows
|
146
|
+
`\"#{path}\" -v | more`.strip[/[^\s]*$/][/^\d+/].to_i
|
147
|
+
when :linux
|
148
|
+
`#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
|
149
|
+
else
|
150
|
+
0
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
133
154
|
private
|
134
155
|
|
135
156
|
def windows_path
|
136
|
-
windows_registry_path ||
|
157
|
+
windows_registry_path ||
|
158
|
+
Platform.find_in_program_files('\\Mozilla Firefox\\firefox.exe') ||
|
159
|
+
Platform.find_binary('firefox')
|
137
160
|
end
|
138
161
|
|
139
162
|
def macosx_path
|
140
|
-
path =
|
141
|
-
path =
|
163
|
+
path = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
|
164
|
+
path = File.expand_path('~/Applications/Firefox.app/Contents/MacOS/firefox-bin') unless File.exist?(path)
|
165
|
+
path = Platform.find_binary('firefox-bin') unless File.exist?(path)
|
142
166
|
|
143
167
|
path
|
144
168
|
end
|
@@ -147,18 +171,16 @@ module Selenium
|
|
147
171
|
require 'win32/registry'
|
148
172
|
|
149
173
|
lm = Win32::Registry::HKEY_LOCAL_MACHINE
|
150
|
-
lm.open(
|
174
|
+
lm.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|
|
151
175
|
main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
|
152
|
-
|
153
|
-
|
154
|
-
end
|
176
|
+
entry = main.find { |key, _type, _data| key =~ /pathtoexe/i }
|
177
|
+
return entry.last if entry
|
155
178
|
end
|
156
179
|
rescue LoadError
|
157
180
|
# older JRuby or IronRuby does not have win32/registry
|
158
181
|
rescue Win32::Registry::Error
|
159
182
|
end
|
160
183
|
end # class << self
|
161
|
-
|
162
184
|
end # Binary
|
163
185
|
end # Firefox
|
164
186
|
end # WebDriver
|
@@ -0,0 +1,50 @@
|
|
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
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module Firefox
|
23
|
+
module Driver
|
24
|
+
class << self
|
25
|
+
|
26
|
+
#
|
27
|
+
# Instantiates correct Firefox driver implementation
|
28
|
+
# @return [Marionette::Driver, Legacy::Driver]
|
29
|
+
#
|
30
|
+
|
31
|
+
def new(**opts)
|
32
|
+
if marionette?(opts)
|
33
|
+
Firefox::Marionette::Driver.new(opts)
|
34
|
+
else
|
35
|
+
Firefox::Legacy::Driver.new(opts)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def marionette?(opts)
|
42
|
+
opts.delete(:marionette) != false &&
|
43
|
+
(!opts[:desired_capabilities] || opts[:desired_capabilities][:marionette] != false)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end # Driver
|
48
|
+
end # Firefox
|
49
|
+
end # WebDriver
|
50
|
+
end # Selenium
|
@@ -2,15 +2,18 @@
|
|
2
2
|
"frozen": {
|
3
3
|
"app.update.auto": false,
|
4
4
|
"app.update.enabled": false,
|
5
|
+
"browser.displayedE10SNotice": 4,
|
5
6
|
"browser.download.manager.showWhenStarting": false,
|
6
7
|
"browser.EULA.override": true,
|
7
8
|
"browser.EULA.3.accepted": true,
|
8
9
|
"browser.link.open_external": 2,
|
9
10
|
"browser.link.open_newwindow": 2,
|
10
11
|
"browser.offline": false,
|
12
|
+
"browser.reader.detectedFirstArticle": true,
|
11
13
|
"browser.safebrowsing.enabled": false,
|
12
14
|
"browser.safebrowsing.malware.enabled": false,
|
13
15
|
"browser.search.update": false,
|
16
|
+
"browser.selfsupport.url" : "",
|
14
17
|
"browser.sessionstore.resume_from_crash": false,
|
15
18
|
"browser.shell.checkDefaultBrowser": false,
|
16
19
|
"browser.tabs.warnOnClose": false,
|
@@ -25,43 +28,41 @@
|
|
25
28
|
"dom.disable_open_during_load": false,
|
26
29
|
"extensions.autoDisableScopes": 10,
|
27
30
|
"extensions.blocklist.enabled": false,
|
28
|
-
"extensions.
|
31
|
+
"extensions.checkCompatibility.nightly": false,
|
29
32
|
"extensions.update.enabled": false,
|
30
33
|
"extensions.update.notifyUser": false,
|
34
|
+
"javascript.enabled": true,
|
31
35
|
"network.manage-offline-status": false,
|
32
36
|
"network.http.phishy-userpass-length": 255,
|
33
37
|
"offline-apps.allow_by_default": true,
|
34
38
|
"prompts.tab_modal.enabled": false,
|
35
|
-
"security.csp.enable": false,
|
36
39
|
"security.fileuri.origin_policy": 3,
|
37
40
|
"security.fileuri.strict_origin_policy": false,
|
38
|
-
"security.warn_entering_secure": false,
|
39
|
-
"security.warn_entering_secure.show_once": false,
|
40
|
-
"security.warn_entering_weak": false,
|
41
|
-
"security.warn_entering_weak.show_once": false,
|
42
|
-
"security.warn_leaving_secure": false,
|
43
|
-
"security.warn_leaving_secure.show_once": false,
|
44
|
-
"security.warn_submit_insecure": false,
|
45
|
-
"security.warn_viewing_mixed": false,
|
46
|
-
"security.warn_viewing_mixed.show_once": false,
|
47
41
|
"signon.rememberSignons": false,
|
48
42
|
"toolkit.networkmanager.disable": true,
|
49
43
|
"toolkit.telemetry.prompted": 2,
|
50
44
|
"toolkit.telemetry.enabled": false,
|
51
|
-
"toolkit.telemetry.rejected": true
|
45
|
+
"toolkit.telemetry.rejected": true,
|
46
|
+
"xpinstall.signatures.required": false,
|
47
|
+
"xpinstall.whitelist.required": false
|
52
48
|
},
|
53
49
|
"mutable": {
|
54
50
|
"browser.dom.window.dump.enabled": true,
|
51
|
+
"browser.laterrun.enabled": false,
|
55
52
|
"browser.newtab.url": "about:blank",
|
56
53
|
"browser.newtabpage.enabled": false,
|
57
54
|
"browser.startup.page": 0,
|
58
55
|
"browser.startup.homepage": "about:blank",
|
56
|
+
"browser.startup.homepage_override.mstone": "ignore",
|
57
|
+
"browser.usedOnWindows10.introURL": "about:blank",
|
59
58
|
"dom.max_chrome_script_run_time": 30,
|
60
59
|
"dom.max_script_run_time": 30,
|
61
60
|
"dom.report_all_js_exceptions": true,
|
62
61
|
"javascript.options.showInConsole": true,
|
63
|
-
"network.
|
62
|
+
"network.captive-portal-service.enabled": false,
|
63
|
+
"security.csp.enable": false,
|
64
64
|
"startup.homepage_welcome_url": "about:blank",
|
65
|
+
"startup.homepage_welcome_url.additional": "about:blank",
|
65
66
|
"webdriver_accept_untrusted_certs": true,
|
66
67
|
"webdriver_assume_untrusted_issuer": true
|
67
68
|
}
|
Binary file
|