selenium-webdriver 3.142.7 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES +432 -5
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/NOTICE +2 -0
- data/README.md +4 -5
- data/lib/selenium/server.rb +75 -64
- data/lib/selenium/webdriver/atoms/findElements.js +122 -0
- data/lib/selenium/webdriver/atoms/getAttribute.js +100 -7
- data/lib/selenium/webdriver/atoms/isDisplayed.js +76 -78
- data/lib/selenium/webdriver/atoms/mutationListener.js +55 -0
- data/lib/selenium/webdriver/bidi/session.rb +38 -0
- data/lib/selenium/webdriver/bidi.rb +55 -0
- data/lib/selenium/webdriver/chrome/driver.rb +26 -83
- data/lib/selenium/webdriver/chrome/{bridge.rb → features.rb} +55 -12
- data/lib/selenium/webdriver/chrome/options.rb +138 -67
- data/lib/selenium/webdriver/chrome/profile.rb +6 -3
- data/lib/selenium/webdriver/chrome/service.rb +8 -15
- data/lib/selenium/webdriver/chrome.rb +5 -18
- data/lib/selenium/webdriver/common/action_builder.rb +171 -236
- data/lib/selenium/webdriver/common/driver.rb +76 -29
- data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +43 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +89 -0
- data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_bidi.rb} +10 -8
- data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +87 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +38 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +44 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +43 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +38 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +5 -8
- data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +144 -0
- data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_logs.rb} +4 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +17 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +6 -27
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +136 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +11 -11
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +77 -0
- data/lib/selenium/webdriver/common/driver_extensions/{rotatable.rb → prints_page.rb} +18 -20
- data/lib/selenium/webdriver/common/element.rb +83 -23
- data/lib/selenium/webdriver/common/error.rb +32 -196
- data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
- data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -22
- data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +10 -6
- data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
- data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
- data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +68 -78
- data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
- data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
- data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
- data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
- data/lib/selenium/webdriver/common/interactions/scroll.rb +57 -0
- data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
- data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
- data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
- data/lib/selenium/webdriver/common/{w3c_manager.rb → interactions/wheel_input.rb} +14 -17
- data/lib/selenium/webdriver/common/keys.rb +1 -0
- data/lib/selenium/webdriver/common/log_entry.rb +2 -2
- data/lib/selenium/webdriver/common/logger.rb +50 -15
- data/lib/selenium/webdriver/common/manager.rb +11 -38
- data/lib/selenium/webdriver/common/options.rb +147 -23
- data/lib/selenium/webdriver/common/platform.rb +10 -5
- data/lib/selenium/webdriver/common/port_prober.rb +4 -6
- data/lib/selenium/webdriver/common/profile_helper.rb +11 -9
- data/lib/selenium/webdriver/common/proxy.rb +6 -3
- data/lib/selenium/webdriver/common/search_context.rb +7 -9
- data/lib/selenium/webdriver/common/service.rb +17 -125
- data/lib/selenium/webdriver/common/service_manager.rb +150 -0
- data/lib/selenium/webdriver/common/shadow_root.rb +87 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
- data/lib/selenium/webdriver/common/socket_poller.rb +3 -3
- data/lib/selenium/webdriver/common/takes_screenshot.rb +66 -0
- data/lib/selenium/webdriver/common/target_locator.rb +32 -4
- data/lib/selenium/webdriver/common/timeouts.rb +31 -4
- data/lib/selenium/webdriver/common/wait.rb +1 -1
- data/lib/selenium/webdriver/common/websocket_connection.rb +149 -0
- data/lib/selenium/webdriver/common/window.rb +0 -4
- data/lib/selenium/webdriver/common/zipper.rb +3 -9
- data/lib/selenium/webdriver/common.rb +35 -18
- data/lib/selenium/webdriver/devtools/console_event.rb +38 -0
- data/lib/selenium/webdriver/devtools/exception_event.rb +36 -0
- data/lib/selenium/webdriver/devtools/mutation_event.rb +37 -0
- data/lib/selenium/webdriver/devtools/pinned_script.rb +59 -0
- data/lib/selenium/webdriver/devtools/request.rb +67 -0
- data/lib/selenium/webdriver/devtools/response.rb +66 -0
- data/lib/selenium/webdriver/devtools.rb +86 -0
- data/lib/selenium/webdriver/edge/driver.rb +7 -29
- data/lib/selenium/webdriver/edge/features.rb +45 -0
- data/lib/selenium/webdriver/edge/options.rb +11 -48
- data/lib/selenium/webdriver/edge/profile.rb +33 -0
- data/lib/selenium/webdriver/edge/service.rb +10 -26
- data/lib/selenium/webdriver/edge.rb +11 -14
- data/lib/selenium/webdriver/firefox/driver.rb +32 -19
- data/lib/selenium/webdriver/firefox/extension.rb +8 -0
- data/lib/selenium/webdriver/firefox/features.rb +63 -0
- data/lib/selenium/webdriver/firefox/options.rb +73 -50
- data/lib/selenium/webdriver/firefox/profile.rb +16 -70
- data/lib/selenium/webdriver/firefox/service.rb +5 -9
- data/lib/selenium/webdriver/firefox/util.rb +1 -1
- data/lib/selenium/webdriver/firefox.rb +17 -28
- data/lib/selenium/webdriver/ie/driver.rb +1 -47
- data/lib/selenium/webdriver/ie/options.rb +15 -46
- data/lib/selenium/webdriver/ie/service.rb +13 -15
- data/lib/selenium/webdriver/ie.rb +3 -16
- data/lib/selenium/webdriver/remote/bridge.rb +563 -86
- data/lib/selenium/webdriver/remote/capabilities.rb +159 -123
- data/lib/selenium/webdriver/remote/commands.rb +158 -0
- data/lib/selenium/webdriver/remote/driver.rb +22 -13
- data/lib/selenium/webdriver/remote/http/common.rb +0 -5
- data/lib/selenium/webdriver/remote/http/default.rb +22 -31
- data/lib/selenium/webdriver/remote/response.rb +18 -49
- data/lib/selenium/webdriver/remote.rb +15 -12
- data/lib/selenium/webdriver/safari/driver.rb +3 -31
- data/lib/selenium/webdriver/safari/{bridge.rb → features.rb} +3 -3
- data/lib/selenium/webdriver/safari/options.rb +10 -29
- data/lib/selenium/webdriver/safari/service.rb +4 -8
- data/lib/selenium/webdriver/safari.rb +13 -19
- data/lib/selenium/webdriver/support/block_event_listener.rb +1 -1
- data/lib/selenium/webdriver/support/cdp/domain.rb.erb +63 -0
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +108 -0
- data/lib/selenium/webdriver/support/color.rb +9 -9
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
- data/lib/selenium/webdriver/support/guards/guard.rb +89 -0
- data/lib/selenium/webdriver/{firefox/marionette/bridge.rb → support/guards/guard_condition.rb} +22 -19
- data/lib/selenium/webdriver/support/guards.rb +95 -0
- data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
- data/lib/selenium/webdriver/support/select.rb +3 -3
- data/lib/selenium/webdriver/support.rb +1 -0
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +14 -13
- data/selenium-webdriver.gemspec +32 -13
- metadata +176 -69
- data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -64
- data/lib/selenium/webdriver/common/keyboard.rb +0 -70
- data/lib/selenium/webdriver/common/mouse.rb +0 -89
- data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
- data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
- data/lib/selenium/webdriver/edge/bridge.rb +0 -76
- data/lib/selenium/webdriver/firefox/binary.rb +0 -187
- data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
- data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
- data/lib/selenium/webdriver/remote/http/persistent.rb +0 -60
- data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
- data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
- data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -1,187 +0,0 @@
|
|
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
|
-
# @api private
|
24
|
-
class Binary
|
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
|
32
|
-
|
33
|
-
WAIT_TIMEOUT = 90
|
34
|
-
QUIT_TIMEOUT = 5
|
35
|
-
|
36
|
-
def start_with(profile, profile_path, *args)
|
37
|
-
if Platform.cygwin?
|
38
|
-
profile_path = Platform.cygwin_path(profile_path, windows: true)
|
39
|
-
elsif Platform.windows?
|
40
|
-
profile_path = Platform.windows_path(profile_path)
|
41
|
-
end
|
42
|
-
|
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
|
46
|
-
ENV['MOZ_CRASHREPORTER_DISABLE'] = '1' # disable breakpad
|
47
|
-
ENV['NO_EM_RESTART'] = '1' # prevent the binary from detaching from the console
|
48
|
-
|
49
|
-
modify_link_library_path profile_path if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
|
50
|
-
|
51
|
-
execute(*args)
|
52
|
-
end
|
53
|
-
|
54
|
-
def quit
|
55
|
-
return unless @process
|
56
|
-
|
57
|
-
@process.poll_for_exit QUIT_TIMEOUT
|
58
|
-
rescue ChildProcess::TimeoutError
|
59
|
-
# ok, force quit
|
60
|
-
@process.stop QUIT_TIMEOUT
|
61
|
-
end
|
62
|
-
|
63
|
-
def wait
|
64
|
-
return unless @process
|
65
|
-
|
66
|
-
begin
|
67
|
-
@process.poll_for_exit(WAIT_TIMEOUT)
|
68
|
-
rescue ChildProcess::TimeoutError => e
|
69
|
-
@process.stop
|
70
|
-
raise e
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def execute(*extra_args)
|
77
|
-
args = [self.class.path, '-no-remote'] + extra_args
|
78
|
-
@process = ChildProcess.build(*args)
|
79
|
-
WebDriver.logger.debug("Executing Process #{args}")
|
80
|
-
|
81
|
-
@process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug?
|
82
|
-
@process.start
|
83
|
-
end
|
84
|
-
|
85
|
-
def modify_link_library_path(profile_path)
|
86
|
-
paths = []
|
87
|
-
|
88
|
-
NO_FOCUS_LIBRARIES.each do |from, to|
|
89
|
-
dest = File.join(profile_path, to)
|
90
|
-
FileUtils.mkdir_p File.dirname(dest)
|
91
|
-
FileUtils.cp from, dest
|
92
|
-
|
93
|
-
paths << File.expand_path(File.dirname(dest))
|
94
|
-
end
|
95
|
-
|
96
|
-
paths += ENV['LD_LIBRARY_PATH'].to_s.split(File::PATH_SEPARATOR)
|
97
|
-
|
98
|
-
ENV['LD_LIBRARY_PATH'] = paths.uniq.join(File::PATH_SEPARATOR)
|
99
|
-
ENV['LD_PRELOAD'] = NO_FOCUS_LIBRARY_NAME
|
100
|
-
end
|
101
|
-
|
102
|
-
class << self
|
103
|
-
#
|
104
|
-
# @api private
|
105
|
-
#
|
106
|
-
# @see Firefox.path=
|
107
|
-
#
|
108
|
-
|
109
|
-
def path=(path)
|
110
|
-
Platform.assert_executable(path)
|
111
|
-
@path = path
|
112
|
-
end
|
113
|
-
|
114
|
-
def reset_path!
|
115
|
-
@path = nil
|
116
|
-
end
|
117
|
-
|
118
|
-
def path
|
119
|
-
@path ||= case Platform.os
|
120
|
-
when :macosx
|
121
|
-
macosx_path
|
122
|
-
when :windows
|
123
|
-
windows_path
|
124
|
-
when :linux, :unix
|
125
|
-
Platform.find_binary('firefox3', 'firefox2', 'firefox') || '/usr/bin/firefox'
|
126
|
-
else
|
127
|
-
raise Error::WebDriverError, "unknown platform: #{Platform.os}"
|
128
|
-
end
|
129
|
-
|
130
|
-
@path = Platform.cygwin_path(@path, windows: true) if Platform.cygwin?
|
131
|
-
|
132
|
-
unless File.file?(@path.to_s)
|
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
|
136
|
-
end
|
137
|
-
|
138
|
-
@path
|
139
|
-
end
|
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
|
-
|
154
|
-
private
|
155
|
-
|
156
|
-
def windows_path
|
157
|
-
windows_registry_path ||
|
158
|
-
Platform.find_in_program_files('\\Mozilla Firefox\\firefox.exe') ||
|
159
|
-
Platform.find_binary('firefox')
|
160
|
-
end
|
161
|
-
|
162
|
-
def macosx_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)
|
166
|
-
|
167
|
-
path
|
168
|
-
end
|
169
|
-
|
170
|
-
def windows_registry_path
|
171
|
-
require 'win32/registry'
|
172
|
-
|
173
|
-
lm = Win32::Registry::HKEY_LOCAL_MACHINE
|
174
|
-
lm.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|
|
175
|
-
main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
|
176
|
-
entry = main.find { |key, _type, _data| key =~ /pathtoexe/i }
|
177
|
-
return entry.last if entry
|
178
|
-
end
|
179
|
-
rescue LoadError
|
180
|
-
# older JRuby or IronRuby does not have win32/registry
|
181
|
-
rescue Win32::Registry::Error
|
182
|
-
end
|
183
|
-
end # class << self
|
184
|
-
end # Binary
|
185
|
-
end # Firefox
|
186
|
-
end # WebDriver
|
187
|
-
end # Selenium
|
@@ -1,69 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"frozen": {
|
3
|
-
"app.update.auto": false,
|
4
|
-
"app.update.enabled": false,
|
5
|
-
"browser.displayedE10SNotice": 4,
|
6
|
-
"browser.download.manager.showWhenStarting": false,
|
7
|
-
"browser.EULA.override": true,
|
8
|
-
"browser.EULA.3.accepted": true,
|
9
|
-
"browser.link.open_external": 2,
|
10
|
-
"browser.link.open_newwindow": 2,
|
11
|
-
"browser.offline": false,
|
12
|
-
"browser.reader.detectedFirstArticle": true,
|
13
|
-
"browser.safebrowsing.enabled": false,
|
14
|
-
"browser.safebrowsing.malware.enabled": false,
|
15
|
-
"browser.search.update": false,
|
16
|
-
"browser.selfsupport.url" : "",
|
17
|
-
"browser.sessionstore.resume_from_crash": false,
|
18
|
-
"browser.shell.checkDefaultBrowser": false,
|
19
|
-
"browser.tabs.warnOnClose": false,
|
20
|
-
"browser.tabs.warnOnOpen": false,
|
21
|
-
"datareporting.healthreport.service.enabled": false,
|
22
|
-
"datareporting.healthreport.uploadEnabled": false,
|
23
|
-
"datareporting.healthreport.service.firstRun": false,
|
24
|
-
"datareporting.healthreport.logging.consoleEnabled": false,
|
25
|
-
"datareporting.policy.dataSubmissionEnabled": false,
|
26
|
-
"datareporting.policy.dataSubmissionPolicyAccepted": false,
|
27
|
-
"devtools.errorconsole.enabled": true,
|
28
|
-
"dom.disable_open_during_load": false,
|
29
|
-
"extensions.autoDisableScopes": 10,
|
30
|
-
"extensions.blocklist.enabled": false,
|
31
|
-
"extensions.checkCompatibility.nightly": false,
|
32
|
-
"extensions.update.enabled": false,
|
33
|
-
"extensions.update.notifyUser": false,
|
34
|
-
"javascript.enabled": true,
|
35
|
-
"network.manage-offline-status": false,
|
36
|
-
"network.http.phishy-userpass-length": 255,
|
37
|
-
"offline-apps.allow_by_default": true,
|
38
|
-
"prompts.tab_modal.enabled": false,
|
39
|
-
"security.fileuri.origin_policy": 3,
|
40
|
-
"security.fileuri.strict_origin_policy": false,
|
41
|
-
"signon.rememberSignons": false,
|
42
|
-
"toolkit.networkmanager.disable": true,
|
43
|
-
"toolkit.telemetry.prompted": 2,
|
44
|
-
"toolkit.telemetry.enabled": false,
|
45
|
-
"toolkit.telemetry.rejected": true,
|
46
|
-
"xpinstall.signatures.required": false,
|
47
|
-
"xpinstall.whitelist.required": false
|
48
|
-
},
|
49
|
-
"mutable": {
|
50
|
-
"browser.dom.window.dump.enabled": true,
|
51
|
-
"browser.laterrun.enabled": false,
|
52
|
-
"browser.newtab.url": "about:blank",
|
53
|
-
"browser.newtabpage.enabled": false,
|
54
|
-
"browser.startup.page": 0,
|
55
|
-
"browser.startup.homepage": "about:blank",
|
56
|
-
"browser.startup.homepage_override.mstone": "ignore",
|
57
|
-
"browser.usedOnWindows10.introURL": "about:blank",
|
58
|
-
"dom.max_chrome_script_run_time": 30,
|
59
|
-
"dom.max_script_run_time": 30,
|
60
|
-
"dom.report_all_js_exceptions": true,
|
61
|
-
"javascript.options.showInConsole": true,
|
62
|
-
"network.captive-portal-service.enabled": false,
|
63
|
-
"security.csp.enable": false,
|
64
|
-
"startup.homepage_welcome_url": "about:blank",
|
65
|
-
"startup.homepage_welcome_url.additional": "about:blank",
|
66
|
-
"webdriver_accept_untrusted_certs": true,
|
67
|
-
"webdriver_assume_untrusted_issuer": true
|
68
|
-
}
|
69
|
-
}
|
Binary file
|
@@ -1,111 +0,0 @@
|
|
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
|
-
# @api private
|
24
|
-
class Launcher
|
25
|
-
SOCKET_LOCK_TIMEOUT = 45
|
26
|
-
STABLE_CONNECTION_TIMEOUT = 60
|
27
|
-
|
28
|
-
def initialize(binary, port, profile = nil)
|
29
|
-
@binary = binary
|
30
|
-
@port = Integer(port)
|
31
|
-
|
32
|
-
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
33
|
-
|
34
|
-
if profile.is_a? Profile
|
35
|
-
@profile = profile
|
36
|
-
else
|
37
|
-
@profile_name = profile
|
38
|
-
@profile = nil
|
39
|
-
end
|
40
|
-
|
41
|
-
@host = '127.0.0.1'
|
42
|
-
end
|
43
|
-
|
44
|
-
def url
|
45
|
-
"http://#{@host}:#{@port}/hub"
|
46
|
-
end
|
47
|
-
|
48
|
-
def launch
|
49
|
-
socket_lock.locked do
|
50
|
-
find_free_port
|
51
|
-
create_profile
|
52
|
-
start
|
53
|
-
connect_until_stable
|
54
|
-
end
|
55
|
-
|
56
|
-
self
|
57
|
-
end
|
58
|
-
|
59
|
-
def quit
|
60
|
-
@binary.quit
|
61
|
-
FileReaper.reap(@profile_dir) if @profile_dir
|
62
|
-
end
|
63
|
-
|
64
|
-
def find_free_port
|
65
|
-
@port = PortProber.above @port
|
66
|
-
end
|
67
|
-
|
68
|
-
def create_profile
|
69
|
-
fetch_profile unless @profile
|
70
|
-
|
71
|
-
@profile.add_webdriver_extension
|
72
|
-
@profile.port = @port
|
73
|
-
|
74
|
-
@profile_dir = @profile.layout_on_disk
|
75
|
-
FileReaper << @profile_dir
|
76
|
-
end
|
77
|
-
|
78
|
-
def start
|
79
|
-
assert_profile
|
80
|
-
@binary.start_with @profile, @profile_dir, '-foreground'
|
81
|
-
end
|
82
|
-
|
83
|
-
def connect_until_stable
|
84
|
-
poller = SocketPoller.new(@host, @port, STABLE_CONNECTION_TIMEOUT)
|
85
|
-
|
86
|
-
return if poller.connected?
|
87
|
-
|
88
|
-
@binary.quit
|
89
|
-
error = "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds (#{@host}:#{@port})"
|
90
|
-
raise Error::WebDriverError, error
|
91
|
-
end
|
92
|
-
|
93
|
-
def fetch_profile
|
94
|
-
@profile = if @profile_name
|
95
|
-
Profile.from_name @profile_name
|
96
|
-
else
|
97
|
-
Profile.new
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def assert_profile
|
102
|
-
raise Error::WebDriverError, 'must create_profile first' unless @profile && @profile_dir
|
103
|
-
end
|
104
|
-
|
105
|
-
def socket_lock
|
106
|
-
@socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
|
107
|
-
end
|
108
|
-
end # Launcher
|
109
|
-
end # Firefox
|
110
|
-
end # WebDriver
|
111
|
-
end # Selenium
|
@@ -1,83 +0,0 @@
|
|
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 Legacy
|
24
|
-
|
25
|
-
#
|
26
|
-
# Driver implementation for Firefox using legacy extension.
|
27
|
-
# @api private
|
28
|
-
#
|
29
|
-
|
30
|
-
class Driver < WebDriver::Driver
|
31
|
-
include DriverExtensions::TakesScreenshot
|
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
|
37
|
-
|
38
|
-
if opts.key? :proxy
|
39
|
-
WebDriver.logger.deprecate ':proxy', "Selenium::WebDriver::Remote::Capabilities.firefox(proxy: #{opts[:proxy]})"
|
40
|
-
opts[:desired_capabilities].proxy = opts.delete(:proxy)
|
41
|
-
end
|
42
|
-
|
43
|
-
unless opts.key?(:url)
|
44
|
-
port = opts.delete(:port) || DEFAULT_PORT
|
45
|
-
profile = opts.delete(:profile)
|
46
|
-
|
47
|
-
Binary.path = opts[:desired_capabilities][:firefox_binary] if opts[:desired_capabilities][:firefox_binary]
|
48
|
-
@launcher = Launcher.new Binary.new, port, profile
|
49
|
-
@launcher.launch
|
50
|
-
opts[:url] = @launcher.url
|
51
|
-
end
|
52
|
-
|
53
|
-
listener = opts.delete(:listener)
|
54
|
-
WebDriver.logger.info 'Skipping handshake as we know it is OSS.'
|
55
|
-
desired_capabilities = opts.delete(:desired_capabilities)
|
56
|
-
bridge = Remote::Bridge.new(opts)
|
57
|
-
capabilities = bridge.create_session(desired_capabilities)
|
58
|
-
@bridge = Remote::OSS::Bridge.new(capabilities, bridge.session_id, opts)
|
59
|
-
|
60
|
-
begin
|
61
|
-
super(@bridge, listener: listener)
|
62
|
-
rescue
|
63
|
-
@launcher&.quit
|
64
|
-
raise
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def browser
|
69
|
-
:firefox
|
70
|
-
end
|
71
|
-
|
72
|
-
def quit
|
73
|
-
super
|
74
|
-
nil
|
75
|
-
ensure
|
76
|
-
@launcher.quit
|
77
|
-
end
|
78
|
-
|
79
|
-
end # Driver
|
80
|
-
end # Legacy
|
81
|
-
end # Firefox
|
82
|
-
end # WebDriver
|
83
|
-
end # Selenium
|
@@ -1,90 +0,0 @@
|
|
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 Marionette
|
24
|
-
|
25
|
-
#
|
26
|
-
# Driver implementation for Firefox using GeckoDriver.
|
27
|
-
# @api private
|
28
|
-
#
|
29
|
-
|
30
|
-
class Driver < WebDriver::Driver
|
31
|
-
include DriverExtensions::HasAddons
|
32
|
-
include DriverExtensions::HasWebStorage
|
33
|
-
include DriverExtensions::TakesScreenshot
|
34
|
-
|
35
|
-
def initialize(opts = {})
|
36
|
-
opts[:desired_capabilities] = create_capabilities(opts)
|
37
|
-
|
38
|
-
opts[:url] ||= service_url(opts)
|
39
|
-
|
40
|
-
listener = opts.delete(:listener)
|
41
|
-
WebDriver.logger.info 'Skipping handshake as we know it is W3C.'
|
42
|
-
desired_capabilities = opts.delete(:desired_capabilities)
|
43
|
-
bridge = Remote::Bridge.new(opts)
|
44
|
-
capabilities = bridge.create_session(desired_capabilities)
|
45
|
-
@bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
|
46
|
-
@bridge.extend Marionette::Bridge
|
47
|
-
|
48
|
-
super(@bridge, listener: listener)
|
49
|
-
end
|
50
|
-
|
51
|
-
def browser
|
52
|
-
:firefox
|
53
|
-
end
|
54
|
-
|
55
|
-
def quit
|
56
|
-
super
|
57
|
-
ensure
|
58
|
-
@service&.stop
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def create_capabilities(opts)
|
64
|
-
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
|
65
|
-
options = opts.delete(:options) { Options.new }
|
66
|
-
|
67
|
-
firefox_options = opts.delete(:firefox_options)
|
68
|
-
if firefox_options
|
69
|
-
WebDriver.logger.deprecate ':firefox_options', 'Selenium::WebDriver::Firefox::Options'
|
70
|
-
firefox_options.each do |key, value|
|
71
|
-
options.add_option(key, value)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
profile = opts.delete(:profile)
|
76
|
-
if profile
|
77
|
-
WebDriver.logger.deprecate ':profile', 'Selenium::WebDriver::Firefox::Options#profile='
|
78
|
-
options.profile = profile
|
79
|
-
end
|
80
|
-
|
81
|
-
options = options.as_json
|
82
|
-
caps.merge!(options) unless options.empty?
|
83
|
-
|
84
|
-
caps
|
85
|
-
end
|
86
|
-
end # Driver
|
87
|
-
end # Marionette
|
88
|
-
end # Firefox
|
89
|
-
end # WebDriver
|
90
|
-
end # Selenium
|
Binary file
|
Binary file
|
@@ -1,60 +0,0 @@
|
|
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/persistent'
|
21
|
-
|
22
|
-
module Selenium
|
23
|
-
module WebDriver
|
24
|
-
module Remote
|
25
|
-
module Http
|
26
|
-
# @api private
|
27
|
-
class Persistent < Default
|
28
|
-
def close
|
29
|
-
@http&.shutdown
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def new_http_client
|
35
|
-
proxy = nil
|
36
|
-
|
37
|
-
if @proxy
|
38
|
-
unless @proxy.respond_to?(:http)
|
39
|
-
url = @proxy.http
|
40
|
-
raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}" unless url
|
41
|
-
end
|
42
|
-
proxy = URI.parse(url)
|
43
|
-
end
|
44
|
-
|
45
|
-
if Net::HTTP::Persistent::VERSION >= '3'
|
46
|
-
Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
|
47
|
-
else
|
48
|
-
WebDriver.logger.warn 'Support for this version of net-http-persistent is deprecated. Please upgrade.'
|
49
|
-
Net::HTTP::Persistent.new 'webdriver', proxy
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def response_for(request)
|
54
|
-
http.request server_url, request
|
55
|
-
end
|
56
|
-
end # Persistent
|
57
|
-
end # Http
|
58
|
-
end # Remote
|
59
|
-
end # WebDriver
|
60
|
-
end # Selenium
|