selenium-webdriver 4.10.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +46 -0
- data/README.md +1 -1
- data/bin/linux/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/server.rb +4 -16
- data/lib/selenium/webdriver/atoms.rb +6 -3
- data/lib/selenium/webdriver/chrome/driver.rb +2 -2
- data/lib/selenium/webdriver/chrome/service.rb +8 -3
- data/lib/selenium/webdriver/chrome.rb +0 -2
- data/lib/selenium/webdriver/chromium/driver.rb +0 -1
- data/lib/selenium/webdriver/chromium/options.rb +1 -19
- data/lib/selenium/webdriver/chromium.rb +0 -3
- data/lib/selenium/webdriver/common/action_builder.rb +0 -2
- data/lib/selenium/webdriver/common/child_process.rb +2 -2
- data/lib/selenium/webdriver/common/driver.rb +0 -12
- data/lib/selenium/webdriver/common/driver_finder.rb +0 -2
- data/lib/selenium/webdriver/common/local_driver.rb +8 -17
- data/lib/selenium/webdriver/common/options.rb +3 -22
- data/lib/selenium/webdriver/common/platform.rb +0 -49
- data/lib/selenium/webdriver/common/selenium_manager.rb +46 -37
- data/lib/selenium/webdriver/common/service.rb +5 -11
- data/lib/selenium/webdriver/common/service_manager.rb +1 -1
- data/lib/selenium/webdriver/common/websocket_connection.rb +1 -1
- data/lib/selenium/webdriver/common.rb +0 -2
- data/lib/selenium/webdriver/edge/driver.rb +2 -2
- data/lib/selenium/webdriver/edge/service.rb +8 -3
- data/lib/selenium/webdriver/edge.rb +0 -2
- data/lib/selenium/webdriver/firefox/driver.rb +2 -2
- data/lib/selenium/webdriver/firefox/options.rb +1 -16
- data/lib/selenium/webdriver/firefox/service.rb +0 -12
- data/lib/selenium/webdriver/ie/driver.rb +2 -2
- data/lib/selenium/webdriver/ie/options.rb +4 -3
- data/lib/selenium/webdriver/ie/service.rb +0 -16
- data/lib/selenium/webdriver/remote/capabilities.rb +0 -72
- data/lib/selenium/webdriver/remote/driver.rb +12 -0
- data/lib/selenium/webdriver/remote/http/default.rb +1 -2
- data/lib/selenium/webdriver/remote/server_error.rb +1 -1
- data/lib/selenium/webdriver/safari/driver.rb +2 -2
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +1 -0
- metadata +2 -5
- data/lib/selenium/webdriver/chromium/service.rb +0 -42
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +0 -36
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +0 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc5fa0275bc4e0f7675b6579bb652cb2efc20bc47797407a3c1da5cd3ac61959
|
|
4
|
+
data.tar.gz: 35d845b2fab6603c02c7c6d56f8b2e2e21aa956ed1fcbe01adc0ec0e1b4627d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61ce01ca9e41da013f55b0a970f3c4fe68e496132fd3f70c7a4770e1874dfdbc3a0102e530cbc01e9e4cfc4dd02614eee6120366471e2e07da9cb0d097222e78
|
|
7
|
+
data.tar.gz: 00ebdefe7adc44e8d535a6ab2099ea6233d6a2d9d5c2960a93ac001c34657a7860857e3387c3c93053f034bcccda4dc8120325c105c16bd0ba7151acb8e1211e
|
data/CHANGES
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
4.14.0 (Unreleased)
|
|
2
|
+
=========================
|
|
3
|
+
Ruby:
|
|
4
|
+
* allow users to access the full script of the atom directly
|
|
5
|
+
|
|
6
|
+
BiDi:
|
|
7
|
+
* Released selenium-devtools 0.118.0 (supports CDP v85, v116, v117, v118)
|
|
8
|
+
|
|
9
|
+
4.13.1 (2023-09-25)
|
|
10
|
+
=========================
|
|
11
|
+
Ruby:
|
|
12
|
+
* Fix bug preventing logging chromedriver to file
|
|
13
|
+
|
|
14
|
+
4.13.0 (2023-09-25)
|
|
15
|
+
=========================
|
|
16
|
+
Ruby:
|
|
17
|
+
* Fix bug preventing using performance logging with chromium
|
|
18
|
+
* Allow users to set Selenium Manager path by environment variable (#12752)
|
|
19
|
+
* Allow service to be started before the driver
|
|
20
|
+
* remove deprecated driver extensions for location and network connection
|
|
21
|
+
|
|
22
|
+
BiDi:
|
|
23
|
+
* Released selenium-devtools 0.117.0 (supports CDP v85, v115, v116, v117)
|
|
24
|
+
|
|
25
|
+
4.12.0 (2023-08-31)
|
|
26
|
+
=========================
|
|
27
|
+
Ruby:
|
|
28
|
+
* Fix bug preventing good error messages in Selenium Manager when stdout empty
|
|
29
|
+
* Fix bug with Firefox not loading net/http library by default (#12506)
|
|
30
|
+
* Remove support for using capabilities in local drivers
|
|
31
|
+
|
|
32
|
+
BiDi:
|
|
33
|
+
* Released selenium-devtools 0.116.0 (supports CDP v85, v114, v115, v116)
|
|
34
|
+
|
|
35
|
+
4.11.0 (2023-07-31)
|
|
36
|
+
=========================
|
|
37
|
+
Ruby:
|
|
38
|
+
* Made network interception threads fail silently (#12226)
|
|
39
|
+
* Have Selenium Manager binary locate drivers on PATH (#12345)
|
|
40
|
+
* Add browser output from selenium manager to options (#12398)
|
|
41
|
+
* Remove deprecated code (#12417)
|
|
42
|
+
BiDi:
|
|
43
|
+
* Released selenium-devtools 0.115.0 (supports CDP v85, v113, v114, v115)
|
|
44
|
+
Edge:
|
|
45
|
+
* Adding ignore process match for IE Mode across bindings (#12279)
|
|
46
|
+
|
|
1
47
|
4.10.0 (2023-06-07)
|
|
2
48
|
=========================
|
|
3
49
|
Ruby:
|
data/README.md
CHANGED
|
@@ -15,7 +15,7 @@ This gem provides Ruby bindings for Selenium and supports MRI >= 3.0.
|
|
|
15
15
|
|
|
16
16
|
## License
|
|
17
17
|
|
|
18
|
-
Copyright 2009-
|
|
18
|
+
Copyright 2009-2023 Software Freedom Conservancy
|
|
19
19
|
|
|
20
20
|
Licensed to the Software Freedom Conservancy (SFC) under one
|
|
21
21
|
or more contributor license agreements. See the NOTICE file
|
data/bin/linux/selenium-manager
CHANGED
|
Binary file
|
data/bin/macos/selenium-manager
CHANGED
|
Binary file
|
|
Binary file
|
data/lib/selenium/server.rb
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
20
|
require 'selenium/webdriver/common/child_process'
|
|
21
|
+
require 'selenium/webdriver/common/port_prober'
|
|
21
22
|
require 'selenium/webdriver/common/socket_poller'
|
|
22
23
|
require 'net/http'
|
|
23
24
|
|
|
@@ -165,7 +166,7 @@ module Selenium
|
|
|
165
166
|
# :standalone, #hub, #node
|
|
166
167
|
#
|
|
167
168
|
|
|
168
|
-
attr_accessor :role, :port, :timeout, :background, :log
|
|
169
|
+
attr_accessor :role, :host, :port, :timeout, :background, :log
|
|
169
170
|
|
|
170
171
|
#
|
|
171
172
|
# @param [String] jar Path to the server jar.
|
|
@@ -185,7 +186,7 @@ module Selenium
|
|
|
185
186
|
@jar = jar
|
|
186
187
|
@host = '127.0.0.1'
|
|
187
188
|
@role = opts.fetch(:role, 'standalone')
|
|
188
|
-
@port = opts.fetch(:port, 4444)
|
|
189
|
+
@port = opts.fetch(:port, WebDriver::PortProber.above(4444))
|
|
189
190
|
@timeout = opts.fetch(:timeout, 30)
|
|
190
191
|
@background = opts.fetch(:background, false)
|
|
191
192
|
@additional_args = opts.fetch(:args, [])
|
|
@@ -207,12 +208,6 @@ module Selenium
|
|
|
207
208
|
end
|
|
208
209
|
|
|
209
210
|
def stop
|
|
210
|
-
begin
|
|
211
|
-
Net::HTTP.get(@host, '/selenium-server/driver/?cmd=shutDownSeleniumServer', @port)
|
|
212
|
-
rescue Errno::ECONNREFUSED
|
|
213
|
-
nil
|
|
214
|
-
end
|
|
215
|
-
|
|
216
211
|
stop_process if @process
|
|
217
212
|
poll_for_shutdown
|
|
218
213
|
|
|
@@ -234,13 +229,7 @@ module Selenium
|
|
|
234
229
|
private
|
|
235
230
|
|
|
236
231
|
def stop_process
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
begin
|
|
240
|
-
@process.poll_for_exit(5)
|
|
241
|
-
rescue WebDriver::ChildProcess::TimeoutError
|
|
242
|
-
@process.stop
|
|
243
|
-
end
|
|
232
|
+
@process.stop
|
|
244
233
|
rescue Errno::ECHILD
|
|
245
234
|
# already dead
|
|
246
235
|
ensure
|
|
@@ -254,7 +243,6 @@ module Selenium
|
|
|
254
243
|
args = ['-jar', @jar, @role, '--port', @port.to_s]
|
|
255
244
|
server_command = ['java'] + properties + args + @additional_args
|
|
256
245
|
cp = WebDriver::ChildProcess.build(*server_command)
|
|
257
|
-
WebDriver.logger.debug("Executing Process #{server_command}", id: :server)
|
|
258
246
|
|
|
259
247
|
if @log.is_a?(String)
|
|
260
248
|
cp.io = @log
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
module Selenium
|
|
21
21
|
module WebDriver
|
|
22
22
|
module Atoms
|
|
23
|
+
def atom_script(function_name)
|
|
24
|
+
format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
|
|
25
|
+
atom: read_atom(function_name))
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
private
|
|
24
29
|
|
|
25
30
|
def read_atom(function)
|
|
@@ -27,9 +32,7 @@ module Selenium
|
|
|
27
32
|
end
|
|
28
33
|
|
|
29
34
|
def execute_atom(function_name, *arguments)
|
|
30
|
-
|
|
31
|
-
atom: read_atom(function_name))
|
|
32
|
-
execute_script(script, *arguments)
|
|
35
|
+
execute_script(atom_script(function_name), *arguments)
|
|
33
36
|
end
|
|
34
37
|
end # Atoms
|
|
35
38
|
end # WebDriver
|
|
@@ -30,8 +30,8 @@ module Selenium
|
|
|
30
30
|
class Driver < Chromium::Driver
|
|
31
31
|
include LocalDriver
|
|
32
32
|
|
|
33
|
-
def initialize(
|
|
34
|
-
caps, url = initialize_local_driver(
|
|
33
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
|
34
|
+
caps, url = initialize_local_driver(options, service, url)
|
|
35
35
|
super(caps: caps, url: url, **opts)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -17,15 +17,20 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/chromium/service'
|
|
21
|
-
|
|
22
20
|
module Selenium
|
|
23
21
|
module WebDriver
|
|
24
22
|
module Chrome
|
|
25
|
-
class Service <
|
|
23
|
+
class Service < WebDriver::Service
|
|
26
24
|
DEFAULT_PORT = 9515
|
|
27
25
|
EXECUTABLE = 'chromedriver'
|
|
28
26
|
SHUTDOWN_SUPPORTED = true
|
|
27
|
+
|
|
28
|
+
def log
|
|
29
|
+
return @log unless @log.is_a? String
|
|
30
|
+
|
|
31
|
+
@args << "--log-path=#{@log}"
|
|
32
|
+
@log = nil
|
|
33
|
+
end
|
|
29
34
|
end # Service
|
|
30
35
|
end # Chrome
|
|
31
36
|
end # WebDriver
|
|
@@ -33,7 +33,6 @@ module Selenium
|
|
|
33
33
|
DriverExtensions::HasNetworkInterception,
|
|
34
34
|
DriverExtensions::HasWebStorage,
|
|
35
35
|
DriverExtensions::HasLaunching,
|
|
36
|
-
DriverExtensions::HasLocation,
|
|
37
36
|
DriverExtensions::HasPermissions,
|
|
38
37
|
DriverExtensions::DownloadsFiles,
|
|
39
38
|
DriverExtensions::HasDevTools,
|
|
@@ -47,7 +47,7 @@ module Selenium
|
|
|
47
47
|
#
|
|
48
48
|
# @example
|
|
49
49
|
# options = Selenium::WebDriver::Chrome::Options.new(args: ['start-maximized', 'user-data-dir=/tmp/temp_profile'])
|
|
50
|
-
# driver = Selenium::WebDriver.for(:chrome,
|
|
50
|
+
# driver = Selenium::WebDriver.for(:chrome, options: options)
|
|
51
51
|
#
|
|
52
52
|
# @param [Profile] profile An instance of a Chrome::Profile Class
|
|
53
53
|
# @param [Hash] opts the pre-defined options to create the Chrome::Options with
|
|
@@ -159,24 +159,6 @@ module Selenium
|
|
|
159
159
|
@options[:prefs][name] = value
|
|
160
160
|
end
|
|
161
161
|
|
|
162
|
-
#
|
|
163
|
-
# Run Chrome in headless mode.
|
|
164
|
-
# Old headless uses a non-production browser and is set with `--headless`
|
|
165
|
-
# Native headless from v86 - v108 is set with `--headless=chrome`
|
|
166
|
-
# Native headless from v109+ is set with `--headless=new`
|
|
167
|
-
#
|
|
168
|
-
# @example Enable headless mode
|
|
169
|
-
# options = Selenium::WebDriver::Chrome::Options.new
|
|
170
|
-
# options.headless!
|
|
171
|
-
#
|
|
172
|
-
|
|
173
|
-
def headless!
|
|
174
|
-
WebDriver.logger.deprecate('`Options#headless!`',
|
|
175
|
-
"`Options#add_argument('--headless=new')`",
|
|
176
|
-
id: :headless)
|
|
177
|
-
add_argument '--headless'
|
|
178
|
-
end
|
|
179
|
-
|
|
180
162
|
#
|
|
181
163
|
# Add emulation device information
|
|
182
164
|
#
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'net/http'
|
|
21
|
-
|
|
22
20
|
module Selenium
|
|
23
21
|
module WebDriver
|
|
24
22
|
module Chromium
|
|
@@ -26,7 +24,6 @@ module Selenium
|
|
|
26
24
|
autoload :Driver, 'selenium/webdriver/chromium/driver'
|
|
27
25
|
autoload :Profile, 'selenium/webdriver/chromium/profile'
|
|
28
26
|
autoload :Options, 'selenium/webdriver/chromium/options'
|
|
29
|
-
autoload :Service, 'selenium/webdriver/chromium/service'
|
|
30
27
|
end # Chromium
|
|
31
28
|
end # WebDriver
|
|
32
29
|
end # Selenium
|
|
@@ -33,8 +33,6 @@ module Selenium
|
|
|
33
33
|
# correctly when using asynchronous.
|
|
34
34
|
#
|
|
35
35
|
# @param [Selenium::WebDriver::Remote::Bridge] bridge the bridge for the current driver instance.
|
|
36
|
-
# @param [Selenium::WebDriver::Interactions::PointerInput] deprecated_mouse PointerInput for the mouse.
|
|
37
|
-
# @param [Selenium::WebDriver::Interactions::KeyInput] deprecated_keyboard KeyInput for the keyboard.
|
|
38
36
|
# @param [Boolean] deprecated_async Whether to perform the actions asynchronously per device.
|
|
39
37
|
# Defaults to false for backwards compatibility.
|
|
40
38
|
# @param [Array<Selenium::WebDriver::Interactions::InputDevices>] devices list of valid sources of input.
|
|
@@ -81,11 +81,11 @@ module Selenium
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
def exited?
|
|
84
|
-
return unless @pid
|
|
84
|
+
return false unless @pid
|
|
85
85
|
|
|
86
86
|
WebDriver.logger.debug("Checking if #{@pid} is exited:", id: :process)
|
|
87
87
|
_, @status = Process.waitpid2(@pid, Process::WNOHANG | Process::WUNTRACED) if @status.nil?
|
|
88
|
-
return if @status.nil?
|
|
88
|
+
return false if @status.nil?
|
|
89
89
|
|
|
90
90
|
exit_code = @status.exitstatus || @status.termsig
|
|
91
91
|
WebDriver.logger.debug(" -> exit code is #{exit_code.inspect}", id: :process)
|
|
@@ -318,18 +318,6 @@ module Selenium
|
|
|
318
318
|
end
|
|
319
319
|
end
|
|
320
320
|
|
|
321
|
-
def generate_capabilities(capabilities)
|
|
322
|
-
Array(capabilities).map { |cap|
|
|
323
|
-
if cap.is_a? Symbol
|
|
324
|
-
cap = WebDriver::Options.send(cap)
|
|
325
|
-
elsif !cap.respond_to? :as_json
|
|
326
|
-
msg = ":capabilities parameter only accepts objects responding to #as_json which #{cap.class} does not"
|
|
327
|
-
raise ArgumentError, msg
|
|
328
|
-
end
|
|
329
|
-
cap.as_json
|
|
330
|
-
}.inject(:merge)
|
|
331
|
-
end
|
|
332
|
-
|
|
333
321
|
def service_url(service)
|
|
334
322
|
@service_manager = service.launch
|
|
335
323
|
@service_manager.uri
|
|
@@ -23,7 +23,6 @@ module Selenium
|
|
|
23
23
|
def self.path(options, klass)
|
|
24
24
|
path = klass.driver_path
|
|
25
25
|
path = path.call if path.is_a?(Proc)
|
|
26
|
-
path ||= Platform.find_binary(klass::EXECUTABLE)
|
|
27
26
|
|
|
28
27
|
path ||= begin
|
|
29
28
|
SeleniumManager.driver_path(options) unless options.is_a?(Remote::Capabilities)
|
|
@@ -32,7 +31,6 @@ module Selenium
|
|
|
32
31
|
end
|
|
33
32
|
|
|
34
33
|
begin
|
|
35
|
-
Platform.assert_file(path)
|
|
36
34
|
Platform.assert_executable(path)
|
|
37
35
|
rescue TypeError
|
|
38
36
|
raise Error::NoSuchDriverError, "Unable to locate or obtain #{klass::EXECUTABLE}"
|
|
@@ -20,35 +20,26 @@
|
|
|
20
20
|
module Selenium
|
|
21
21
|
module WebDriver
|
|
22
22
|
module LocalDriver
|
|
23
|
-
def initialize_local_driver(
|
|
23
|
+
def initialize_local_driver(options, service, url)
|
|
24
24
|
raise ArgumentError, "Can't initialize #{self.class} with :url" if url
|
|
25
25
|
|
|
26
26
|
service ||= Service.send(browser)
|
|
27
|
-
caps = process_options(options,
|
|
27
|
+
caps = process_options(options, service)
|
|
28
28
|
url = service_url(service)
|
|
29
29
|
|
|
30
30
|
[caps, url]
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def process_options(options,
|
|
33
|
+
def process_options(options, service)
|
|
34
34
|
default_options = Options.send(browser)
|
|
35
|
+
options ||= default_options
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
msg = "Don't use both :options and :capabilities when initializing #{self.class}, prefer :options"
|
|
38
|
-
raise ArgumentError, msg
|
|
39
|
-
elsif options && !options.is_a?(default_options.class)
|
|
37
|
+
unless options.is_a?(default_options.class)
|
|
40
38
|
raise ArgumentError, ":options must be an instance of #{default_options.class}"
|
|
41
|
-
elsif capabilities
|
|
42
|
-
WebDriver.logger.deprecate("The :capabilities parameter for #{self.class}",
|
|
43
|
-
":options argument with an instance of #{self.class}",
|
|
44
|
-
id: :capabilities)
|
|
45
|
-
service.executable_path ||= WebDriver::DriverFinder.path(capabilities, service.class)
|
|
46
|
-
generate_capabilities(capabilities)
|
|
47
|
-
else
|
|
48
|
-
options ||= default_options
|
|
49
|
-
service.executable_path ||= WebDriver::DriverFinder.path(options, service.class)
|
|
50
|
-
options.as_json
|
|
51
39
|
end
|
|
40
|
+
|
|
41
|
+
service.executable_path ||= WebDriver::DriverFinder.path(options, service.class)
|
|
42
|
+
options.as_json
|
|
52
43
|
end
|
|
53
44
|
end
|
|
54
45
|
end
|
|
@@ -86,12 +86,6 @@ module Selenium
|
|
|
86
86
|
|
|
87
87
|
def add_option(name, value = nil)
|
|
88
88
|
name, value = name.first if value.nil? && name.is_a?(Hash)
|
|
89
|
-
|
|
90
|
-
unless name.to_s.include?(':')
|
|
91
|
-
WebDriver.logger.deprecate('Options#add_option for w3c or browser specific capabilities',
|
|
92
|
-
'applicable attribute accessors or pass into constructor',
|
|
93
|
-
id: :add_option)
|
|
94
|
-
end
|
|
95
89
|
@options[name] = value
|
|
96
90
|
end
|
|
97
91
|
|
|
@@ -113,24 +107,11 @@ module Selenium
|
|
|
113
107
|
w3c_options = process_w3c_options(options)
|
|
114
108
|
|
|
115
109
|
browser_options = self.class::CAPABILITIES.each_with_object({}) do |(capability_alias, capability_name), hash|
|
|
116
|
-
|
|
117
|
-
from_alias = options.delete(capability_alias)
|
|
118
|
-
capability_value = if !from_name.nil? && capability_alias != capability_name
|
|
119
|
-
WebDriver.logger.deprecate("#{capability_name} as option",
|
|
120
|
-
capability_alias.to_s, id: :option_symbols)
|
|
121
|
-
from_name
|
|
122
|
-
elsif !from_alias.nil?
|
|
123
|
-
from_alias
|
|
124
|
-
end
|
|
125
|
-
|
|
110
|
+
capability_value = options.delete(capability_alias)
|
|
126
111
|
hash[capability_name] = capability_value unless capability_value.nil?
|
|
127
112
|
end
|
|
128
113
|
|
|
129
|
-
unless options.empty?
|
|
130
|
-
msg = 'These options are not w3c compliant and will result in failures in a future release'
|
|
131
|
-
WebDriver.logger.warn("#{msg}: #{options}", id: :w3c_options)
|
|
132
|
-
browser_options.merge!(options)
|
|
133
|
-
end
|
|
114
|
+
raise Error::WebDriverError, "These options are not w3c compliant: #{options}" unless options.empty?
|
|
134
115
|
|
|
135
116
|
browser_options = {self.class::KEY => browser_options} if defined?(self.class::KEY)
|
|
136
117
|
|
|
@@ -145,7 +126,7 @@ module Selenium
|
|
|
145
126
|
end
|
|
146
127
|
|
|
147
128
|
def process_w3c_options(options)
|
|
148
|
-
w3c_options = options.select { |key,
|
|
129
|
+
w3c_options = options.select { |key, val| w3c?(key) && !val.nil? }
|
|
149
130
|
w3c_options[:unhandled_prompt_behavior] &&= w3c_options[:unhandled_prompt_behavior]&.to_s&.tr('_', ' ')
|
|
150
131
|
options.delete_if { |key, _val| w3c?(key) }
|
|
151
132
|
w3c_options
|
|
@@ -62,18 +62,6 @@ module Selenium
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def bitsize
|
|
66
|
-
@bitsize ||= if defined?(FFI::Platform::ADDRESS_SIZE)
|
|
67
|
-
FFI::Platform::ADDRESS_SIZE
|
|
68
|
-
elsif defined?(FFI)
|
|
69
|
-
FFI.type_size(:pointer) == 4 ? 32 : 64
|
|
70
|
-
elsif jruby?
|
|
71
|
-
Integer(ENV_JAVA['sun.arch.data.model'])
|
|
72
|
-
else
|
|
73
|
-
1.size == 4 ? 32 : 64
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
65
|
def jruby?
|
|
78
66
|
engine == :jruby
|
|
79
67
|
end
|
|
@@ -158,43 +146,6 @@ module Selenium
|
|
|
158
146
|
at_exit { yield if Process.pid == pid }
|
|
159
147
|
end
|
|
160
148
|
|
|
161
|
-
def find_binary(*binary_names)
|
|
162
|
-
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
|
163
|
-
|
|
164
|
-
if windows?
|
|
165
|
-
binary_names.map! { |n| "#{n}.exe" }
|
|
166
|
-
binary_names.dup.each { |n| binary_names << n.gsub('exe', 'bat') }
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
binary_names.each do |binary_name|
|
|
170
|
-
paths.each do |path|
|
|
171
|
-
full_path = File.join(path, binary_name)
|
|
172
|
-
full_path = unix_path(full_path) if windows?
|
|
173
|
-
exe = Dir.glob(full_path).find { |f| File.executable?(f) }
|
|
174
|
-
return exe if exe
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
nil
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def find_in_program_files(*binary_names)
|
|
182
|
-
paths = [
|
|
183
|
-
ENV.fetch('PROGRAMFILES', '\\Program Files'),
|
|
184
|
-
ENV.fetch('ProgramFiles(x86)', '\\Program Files (x86)'),
|
|
185
|
-
ENV.fetch('ProgramW6432', '\\Program Files')
|
|
186
|
-
]
|
|
187
|
-
|
|
188
|
-
paths.each do |root|
|
|
189
|
-
binary_names.each do |name|
|
|
190
|
-
exe = File.join(root, name)
|
|
191
|
-
return exe if File.executable?(exe)
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
nil
|
|
196
|
-
end
|
|
197
|
-
|
|
198
149
|
def localhost
|
|
199
150
|
info = Socket.getaddrinfo 'localhost', 80, Socket::AF_INET, Socket::SOCK_STREAM
|
|
200
151
|
|
|
@@ -37,22 +37,26 @@ module Selenium
|
|
|
37
37
|
# @param [Options] options browser options.
|
|
38
38
|
# @return [String] the path to the correct driver.
|
|
39
39
|
def driver_path(options)
|
|
40
|
-
message = 'applicable driver not found; attempting to install with Selenium Manager (Beta)'
|
|
41
|
-
WebDriver.logger.debug(message, id: :selenium_manager)
|
|
42
|
-
|
|
43
40
|
command = generate_command(binary, options)
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
output = run(*command)
|
|
43
|
+
|
|
44
|
+
browser_path = output['browser_path']
|
|
45
|
+
driver_path = output['driver_path']
|
|
46
|
+
Platform.assert_executable driver_path
|
|
47
|
+
|
|
48
|
+
if options.respond_to? :binary
|
|
49
|
+
options.binary = browser_path
|
|
50
|
+
options.browser_version = nil
|
|
51
|
+
end
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
driver_path
|
|
50
54
|
end
|
|
51
55
|
|
|
52
56
|
private
|
|
53
57
|
|
|
54
58
|
def generate_command(binary, options)
|
|
55
|
-
command = [binary, '--browser', options.browser_name
|
|
59
|
+
command = [binary, '--browser', options.browser_name]
|
|
56
60
|
if options.browser_version
|
|
57
61
|
command << '--browser-version'
|
|
58
62
|
command << options.browser_version
|
|
@@ -65,59 +69,64 @@ module Selenium
|
|
|
65
69
|
command << '--proxy'
|
|
66
70
|
(command << options.proxy.ssl) || options.proxy.http
|
|
67
71
|
end
|
|
68
|
-
command << '--debug' if WebDriver.logger.debug?
|
|
69
72
|
command
|
|
70
73
|
end
|
|
71
74
|
|
|
72
75
|
# @return [String] the path to the correct selenium manager
|
|
73
76
|
def binary
|
|
74
77
|
@binary ||= begin
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Platform.assert_executable(location)
|
|
88
|
-
rescue TypeError
|
|
89
|
-
raise Error::WebDriverError,
|
|
90
|
-
"Unable to locate or obtain Selenium Manager binary; #{location} is not a valid file object"
|
|
91
|
-
rescue Error::WebDriverError => e
|
|
92
|
-
raise Error::WebDriverError, "Selenium Manager binary located, but #{e.message}"
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
WebDriver.logger.debug("Selenium Manager binary found at #{location}", id: :selenium_manager)
|
|
78
|
+
location = ENV.fetch('SE_MANAGER_PATH', begin
|
|
79
|
+
directory = File.expand_path(bin_path, __FILE__)
|
|
80
|
+
if Platform.windows?
|
|
81
|
+
"#{directory}/windows/selenium-manager.exe"
|
|
82
|
+
elsif Platform.mac?
|
|
83
|
+
"#{directory}/macos/selenium-manager"
|
|
84
|
+
elsif Platform.linux?
|
|
85
|
+
"#{directory}/linux/selenium-manager"
|
|
86
|
+
end
|
|
87
|
+
end)
|
|
88
|
+
|
|
89
|
+
validate_location(location)
|
|
96
90
|
location
|
|
97
91
|
end
|
|
98
92
|
end
|
|
99
93
|
|
|
94
|
+
def validate_location(location)
|
|
95
|
+
begin
|
|
96
|
+
Platform.assert_file(location)
|
|
97
|
+
Platform.assert_executable(location)
|
|
98
|
+
rescue TypeError
|
|
99
|
+
raise Error::WebDriverError,
|
|
100
|
+
"Unable to locate or obtain Selenium Manager binary; #{location} is not a valid file object"
|
|
101
|
+
rescue Error::WebDriverError => e
|
|
102
|
+
raise Error::WebDriverError, "Selenium Manager binary located, but #{e.message}"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
WebDriver.logger.debug("Selenium Manager binary found at #{location}", id: :selenium_manager)
|
|
106
|
+
end
|
|
107
|
+
|
|
100
108
|
def run(*command)
|
|
109
|
+
command += %w[--output json]
|
|
110
|
+
command << '--debug' if WebDriver.logger.debug?
|
|
111
|
+
|
|
101
112
|
WebDriver.logger.debug("Executing Process #{command}", id: :selenium_manager)
|
|
102
113
|
|
|
103
114
|
begin
|
|
104
115
|
stdout, stderr, status = Open3.capture3(*command)
|
|
105
|
-
json_output = stdout.empty? ? nil : JSON.parse(stdout)
|
|
106
|
-
result = json_output&.dig('result', 'message')
|
|
107
116
|
rescue StandardError => e
|
|
108
117
|
raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
|
|
109
118
|
end
|
|
110
119
|
|
|
111
|
-
|
|
120
|
+
json_output = stdout.empty? ? {} : JSON.parse(stdout)
|
|
121
|
+
(json_output['logs'] || []).each do |log|
|
|
112
122
|
level = log['level'].casecmp('info').zero? ? 'debug' : log['level'].downcase
|
|
113
123
|
WebDriver.logger.send(level, log['message'], id: :selenium_manager)
|
|
114
124
|
end
|
|
115
125
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
end
|
|
126
|
+
result = json_output['result']
|
|
127
|
+
return result unless status.exitstatus.positive?
|
|
119
128
|
|
|
120
|
-
result
|
|
129
|
+
raise Error::WebDriverError, "Unsuccessful command executed: #{command}\n#{result}#{stderr}"
|
|
121
130
|
end
|
|
122
131
|
end
|
|
123
132
|
end # SeleniumManager
|
|
@@ -81,28 +81,22 @@ module Selenium
|
|
|
81
81
|
else
|
|
82
82
|
log
|
|
83
83
|
end
|
|
84
|
-
|
|
85
|
-
@args = args.is_a?(Hash) ? extract_service_args(args) : args
|
|
84
|
+
@args = args
|
|
86
85
|
|
|
87
86
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
|
88
87
|
end
|
|
89
88
|
|
|
90
89
|
def launch
|
|
90
|
+
@executable_path ||= begin
|
|
91
|
+
default_options = WebDriver.const_get("#{self.class.name.split('::')[2]}::Options").new
|
|
92
|
+
DriverFinder.path(default_options, self.class)
|
|
93
|
+
end
|
|
91
94
|
ServiceManager.new(self).tap(&:start)
|
|
92
95
|
end
|
|
93
96
|
|
|
94
97
|
def shutdown_supported
|
|
95
98
|
self.class::SHUTDOWN_SUPPORTED
|
|
96
99
|
end
|
|
97
|
-
|
|
98
|
-
protected
|
|
99
|
-
|
|
100
|
-
def extract_service_args(driver_opts)
|
|
101
|
-
WebDriver.logger.deprecate('initializing Service class with :args using Hash',
|
|
102
|
-
':args parameter with an Array of String values',
|
|
103
|
-
id: :driver_opts)
|
|
104
|
-
driver_opts.key?(:args) ? driver_opts.delete(:args) : []
|
|
105
|
-
end
|
|
106
100
|
end # Service
|
|
107
101
|
end # WebDriver
|
|
108
102
|
end # Selenium
|
|
@@ -40,8 +40,8 @@ module Selenium
|
|
|
40
40
|
@executable_path = config.executable_path
|
|
41
41
|
@host = Platform.localhost
|
|
42
42
|
@port = config.port
|
|
43
|
-
@extra_args = config.args
|
|
44
43
|
@io = config.log
|
|
44
|
+
@extra_args = config.args
|
|
45
45
|
@shutdown_supported = config.shutdown_supported
|
|
46
46
|
|
|
47
47
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
|
@@ -68,10 +68,8 @@ require 'selenium/webdriver/common/html5/local_storage'
|
|
|
68
68
|
require 'selenium/webdriver/common/html5/session_storage'
|
|
69
69
|
require 'selenium/webdriver/common/driver_extensions/has_web_storage'
|
|
70
70
|
require 'selenium/webdriver/common/driver_extensions/downloads_files'
|
|
71
|
-
require 'selenium/webdriver/common/driver_extensions/has_location'
|
|
72
71
|
require 'selenium/webdriver/common/driver_extensions/has_session_id'
|
|
73
72
|
require 'selenium/webdriver/common/driver_extensions/has_network_conditions'
|
|
74
|
-
require 'selenium/webdriver/common/driver_extensions/has_network_connection'
|
|
75
73
|
require 'selenium/webdriver/common/driver_extensions/has_network_interception'
|
|
76
74
|
require 'selenium/webdriver/common/driver_extensions/has_apple_permissions'
|
|
77
75
|
require 'selenium/webdriver/common/driver_extensions/has_permissions'
|
|
@@ -30,8 +30,8 @@ module Selenium
|
|
|
30
30
|
class Driver < Chromium::Driver
|
|
31
31
|
include LocalDriver
|
|
32
32
|
|
|
33
|
-
def initialize(
|
|
34
|
-
caps, url = initialize_local_driver(
|
|
33
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
|
34
|
+
caps, url = initialize_local_driver(options, service, url)
|
|
35
35
|
super(caps: caps, url: url, **opts)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -17,15 +17,20 @@
|
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
19
|
|
|
20
|
-
require 'selenium/webdriver/chromium/service'
|
|
21
|
-
|
|
22
20
|
module Selenium
|
|
23
21
|
module WebDriver
|
|
24
22
|
module Edge
|
|
25
|
-
class Service <
|
|
23
|
+
class Service < WebDriver::Service
|
|
26
24
|
DEFAULT_PORT = 9515
|
|
27
25
|
EXECUTABLE = 'msedgedriver'
|
|
28
26
|
SHUTDOWN_SUPPORTED = true
|
|
27
|
+
|
|
28
|
+
def log
|
|
29
|
+
return @log unless @log.is_a? String
|
|
30
|
+
|
|
31
|
+
@args << "--log-path=#{@log}"
|
|
32
|
+
@log = nil
|
|
33
|
+
end
|
|
29
34
|
end # Service
|
|
30
35
|
end # Edge
|
|
31
36
|
end # WebDriver
|
|
@@ -38,8 +38,8 @@ module Selenium
|
|
|
38
38
|
|
|
39
39
|
include LocalDriver
|
|
40
40
|
|
|
41
|
-
def initialize(
|
|
42
|
-
caps, url = initialize_local_driver(
|
|
41
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
|
42
|
+
caps, url = initialize_local_driver(options, service, url)
|
|
43
43
|
super(caps: caps, url: url, **opts)
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -45,7 +45,7 @@ module Selenium
|
|
|
45
45
|
#
|
|
46
46
|
# @example
|
|
47
47
|
# options = Selenium::WebDriver::Firefox::Options.new(args: ['--host=127.0.0.1'])
|
|
48
|
-
# driver = Selenium::WebDriver.for :firefox,
|
|
48
|
+
# driver = Selenium::WebDriver.for :firefox, options: options
|
|
49
49
|
#
|
|
50
50
|
# @param [Hash] opts the pre-defined options to create the Firefox::Options with
|
|
51
51
|
# @option opts [String] :binary Path to the Firefox executable to use
|
|
@@ -99,21 +99,6 @@ module Selenium
|
|
|
99
99
|
@options[:prefs][name] = value
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
#
|
|
103
|
-
# Run Firefox in headless mode.
|
|
104
|
-
#
|
|
105
|
-
# @example Enable headless mode
|
|
106
|
-
# options = Selenium::WebDriver::Firefox::Options.new
|
|
107
|
-
# options.headless!
|
|
108
|
-
#
|
|
109
|
-
|
|
110
|
-
def headless!
|
|
111
|
-
WebDriver.logger.deprecate('`Options#headless!`',
|
|
112
|
-
"`Options#add_argument('-headless')`",
|
|
113
|
-
id: :headless)
|
|
114
|
-
add_argument '-headless'
|
|
115
|
-
end
|
|
116
|
-
|
|
117
102
|
#
|
|
118
103
|
# Sets Firefox profile.
|
|
119
104
|
#
|
|
@@ -24,18 +24,6 @@ module Selenium
|
|
|
24
24
|
DEFAULT_PORT = 4444
|
|
25
25
|
EXECUTABLE = 'geckodriver'
|
|
26
26
|
SHUTDOWN_SUPPORTED = false
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
def extract_service_args(driver_opts)
|
|
31
|
-
driver_args = super
|
|
32
|
-
driver_opts = driver_opts.dup
|
|
33
|
-
driver_args << "--binary=#{driver_opts[:binary]}" if driver_opts.key?(:binary)
|
|
34
|
-
driver_args << "--log=#{driver_opts[:log]}" if driver_opts.key?(:log)
|
|
35
|
-
driver_args << "--marionette-port=#{driver_opts[:marionette_port]}" if driver_opts.key?(:marionette_port)
|
|
36
|
-
driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
|
|
37
|
-
driver_args
|
|
38
|
-
end
|
|
39
27
|
end # Service
|
|
40
28
|
end # Firefox
|
|
41
29
|
end # WebDriver
|
|
@@ -31,8 +31,8 @@ module Selenium
|
|
|
31
31
|
|
|
32
32
|
include LocalDriver
|
|
33
33
|
|
|
34
|
-
def initialize(
|
|
35
|
-
caps, url = initialize_local_driver(
|
|
34
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
|
35
|
+
caps, url = initialize_local_driver(options, service, url)
|
|
36
36
|
super(caps: caps, url: url, **opts)
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -41,7 +41,8 @@ module Selenium
|
|
|
41
41
|
use_per_process_proxy: 'ie.usePerProcessProxy',
|
|
42
42
|
use_legacy_file_upload_dialog_handling: 'ie.useLegacyFileUploadDialogHandling',
|
|
43
43
|
attach_to_edge_chrome: 'ie.edgechromium',
|
|
44
|
-
edge_executable_path: 'ie.edgepath'
|
|
44
|
+
edge_executable_path: 'ie.edgepath',
|
|
45
|
+
ignore_process_match: 'ie.ignoreprocessmatch'
|
|
45
46
|
}.freeze
|
|
46
47
|
BROWSER = 'internet explorer'
|
|
47
48
|
|
|
@@ -52,12 +53,12 @@ module Selenium
|
|
|
52
53
|
#
|
|
53
54
|
# @example
|
|
54
55
|
# options = Selenium::WebDriver::IE::Options.new(args: ['--host=127.0.0.1'])
|
|
55
|
-
# driver = Selenium::WebDriver.for(:ie,
|
|
56
|
+
# driver = Selenium::WebDriver.for(:ie, options: options)
|
|
56
57
|
#
|
|
57
58
|
# @example
|
|
58
59
|
# options = Selenium::WebDriver::IE::Options.new
|
|
59
60
|
# options.element_scroll_behavior = Selenium::WebDriver::IE::Options::SCROLL_BOTTOM
|
|
60
|
-
# driver = Selenium::WebDriver.for(:ie,
|
|
61
|
+
# driver = Selenium::WebDriver.for(:ie, options: options)
|
|
61
62
|
#
|
|
62
63
|
# @param [Hash] opts the pre-defined options
|
|
63
64
|
# @option opts [Array<String>] args
|
|
@@ -24,22 +24,6 @@ module Selenium
|
|
|
24
24
|
DEFAULT_PORT = 5555
|
|
25
25
|
EXECUTABLE = 'IEDriverServer'
|
|
26
26
|
SHUTDOWN_SUPPORTED = true
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
def extract_service_args(driver_opts)
|
|
31
|
-
driver_args = super
|
|
32
|
-
driver_opts = driver_opts.dup
|
|
33
|
-
driver_args << "--log-level=#{driver_opts[:log_level].to_s.upcase}" if driver_opts.key?(:log_level)
|
|
34
|
-
driver_args << "--log-file=#{driver_opts[:log_file]}" if driver_opts.key?(:log_file)
|
|
35
|
-
if driver_opts.key?(:implementation)
|
|
36
|
-
driver_args << "--implementation=#{driver_opts[:implementation].to_s.upcase}"
|
|
37
|
-
end
|
|
38
|
-
driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
|
|
39
|
-
driver_args << "--extract_path=#{driver_opts[:extract_path]}" if driver_opts.key?(:extract_path)
|
|
40
|
-
driver_args << '--silent' if driver_opts[:silent] == true
|
|
41
|
-
driver_args
|
|
42
|
-
end
|
|
43
27
|
end # Server
|
|
44
28
|
end # IE
|
|
45
29
|
end # WebDriver
|
|
@@ -53,83 +53,11 @@ module Selenium
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
#
|
|
57
|
-
# Backward compatibility
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
def version
|
|
61
|
-
WebDriver.logger.deprecate('`Capabilities#version`', '`Capabilities#browser_version`', id: :jwp_caps)
|
|
62
|
-
browser_version
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def version=(value)
|
|
66
|
-
WebDriver.logger.deprecate('`Capabilities#version=`', '`Capabilities#browser_version=`', id: :jwp_caps)
|
|
67
|
-
self.browser_version = value
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def platform
|
|
71
|
-
WebDriver.logger.deprecate('`Capabilities#platform`', '`Capabilities#platform_name`', id: :jwp_caps)
|
|
72
|
-
platform_name
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def platform=(value)
|
|
76
|
-
WebDriver.logger.deprecate('`Capabilities#platform=`', '`Capabilities#platform_name=`', id: :jwp_caps)
|
|
77
|
-
self.platform_name = value
|
|
78
|
-
end
|
|
79
|
-
|
|
80
56
|
#
|
|
81
57
|
# Convenience methods for the common choices.
|
|
82
58
|
#
|
|
83
59
|
|
|
84
60
|
class << self
|
|
85
|
-
def chrome(opts = {})
|
|
86
|
-
WebDriver.logger.deprecate('Remote::Capabilities.chrome', 'Options.chrome', id: :caps_browsers)
|
|
87
|
-
new({
|
|
88
|
-
browser_name: 'chrome'
|
|
89
|
-
}.merge(opts))
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def edge(opts = {})
|
|
93
|
-
WebDriver.logger.deprecate('Remote::Capabilities.edge', 'Options.edge', id: :caps_browsers)
|
|
94
|
-
new({
|
|
95
|
-
browser_name: 'MicrosoftEdge'
|
|
96
|
-
}.merge(opts))
|
|
97
|
-
end
|
|
98
|
-
alias microsoftedge edge
|
|
99
|
-
|
|
100
|
-
def firefox(opts = {})
|
|
101
|
-
WebDriver.logger.deprecate('Remote::Capabilities.firefox', 'Options.firefox', id: :caps_browsers)
|
|
102
|
-
new({
|
|
103
|
-
browser_name: 'firefox'
|
|
104
|
-
}.merge(opts))
|
|
105
|
-
end
|
|
106
|
-
alias ff firefox
|
|
107
|
-
|
|
108
|
-
def safari(opts = {})
|
|
109
|
-
WebDriver.logger.deprecate('Remote::Capabilities.safari', 'Options.safari', id: :caps_browsers)
|
|
110
|
-
new({
|
|
111
|
-
browser_name: Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
|
|
112
|
-
}.merge(opts))
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def htmlunit(opts = {})
|
|
116
|
-
WebDriver.logger.deprecate('Remote::Capabilities.htmlunit',
|
|
117
|
-
'as argument in constructor',
|
|
118
|
-
id: :caps_browsers)
|
|
119
|
-
new({
|
|
120
|
-
browser_name: 'htmlunit'
|
|
121
|
-
}.merge(opts))
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def internet_explorer(opts = {})
|
|
125
|
-
WebDriver.logger.deprecate('Remote::Capabilities.ie', 'Options.ie', id: :caps_browsers)
|
|
126
|
-
new({
|
|
127
|
-
browser_name: 'internet explorer',
|
|
128
|
-
platform_name: :windows
|
|
129
|
-
}.merge(opts))
|
|
130
|
-
end
|
|
131
|
-
alias ie internet_explorer
|
|
132
|
-
|
|
133
61
|
def always_match(capabilities)
|
|
134
62
|
new(always_match: capabilities)
|
|
135
63
|
end
|
|
@@ -60,6 +60,18 @@ module Selenium
|
|
|
60
60
|
end
|
|
61
61
|
options ? options.as_json : generate_capabilities(capabilities)
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
def generate_capabilities(capabilities)
|
|
65
|
+
Array(capabilities).map { |cap|
|
|
66
|
+
if cap.is_a? Symbol
|
|
67
|
+
cap = WebDriver::Options.send(cap)
|
|
68
|
+
elsif !cap.respond_to? :as_json
|
|
69
|
+
msg = ":capabilities parameter only accepts objects responding to #as_json which #{cap.class} does not"
|
|
70
|
+
raise ArgumentError, msg
|
|
71
|
+
end
|
|
72
|
+
cap.as_json
|
|
73
|
+
}.inject(:merge)
|
|
74
|
+
end
|
|
63
75
|
end # Driver
|
|
64
76
|
end # Remote
|
|
65
77
|
end # WebDriver
|
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
# KIND, either express or implied. See the License for the
|
|
17
17
|
# specific language governing permissions and limitations
|
|
18
18
|
# under the License.
|
|
19
|
-
|
|
20
|
-
require 'net/https'
|
|
21
19
|
require 'ipaddr'
|
|
22
20
|
|
|
23
21
|
module Selenium
|
|
@@ -96,6 +94,7 @@ module Selenium
|
|
|
96
94
|
end
|
|
97
95
|
|
|
98
96
|
if response.is_a? Net::HTTPRedirection
|
|
97
|
+
WebDriver.logger.debug("Redirect to #{response['Location']}; times: #{redirects}")
|
|
99
98
|
raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS
|
|
100
99
|
|
|
101
100
|
request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
|
|
@@ -32,8 +32,8 @@ module Selenium
|
|
|
32
32
|
|
|
33
33
|
include LocalDriver
|
|
34
34
|
|
|
35
|
-
def initialize(
|
|
36
|
-
caps, url = initialize_local_driver(
|
|
35
|
+
def initialize(options: nil, service: nil, url: nil, **opts)
|
|
36
|
+
caps, url = initialize_local_driver(options, service, url)
|
|
37
37
|
super(caps: caps, url: url, **opts)
|
|
38
38
|
end
|
|
39
39
|
|
data/lib/selenium/webdriver.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: selenium-webdriver
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Rodionov
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2023-
|
|
13
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rexml
|
|
@@ -242,7 +242,6 @@ files:
|
|
|
242
242
|
- lib/selenium/webdriver/chromium/features.rb
|
|
243
243
|
- lib/selenium/webdriver/chromium/options.rb
|
|
244
244
|
- lib/selenium/webdriver/chromium/profile.rb
|
|
245
|
-
- lib/selenium/webdriver/chromium/service.rb
|
|
246
245
|
- lib/selenium/webdriver/common.rb
|
|
247
246
|
- lib/selenium/webdriver/common/action_builder.rb
|
|
248
247
|
- lib/selenium/webdriver/common/alert.rb
|
|
@@ -260,11 +259,9 @@ files:
|
|
|
260
259
|
- lib/selenium/webdriver/common/driver_extensions/has_debugger.rb
|
|
261
260
|
- lib/selenium/webdriver/common/driver_extensions/has_devtools.rb
|
|
262
261
|
- lib/selenium/webdriver/common/driver_extensions/has_launching.rb
|
|
263
|
-
- lib/selenium/webdriver/common/driver_extensions/has_location.rb
|
|
264
262
|
- lib/selenium/webdriver/common/driver_extensions/has_log_events.rb
|
|
265
263
|
- lib/selenium/webdriver/common/driver_extensions/has_logs.rb
|
|
266
264
|
- lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb
|
|
267
|
-
- lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb
|
|
268
265
|
- lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb
|
|
269
266
|
- lib/selenium/webdriver/common/driver_extensions/has_permissions.rb
|
|
270
267
|
- lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb
|
|
@@ -1,42 +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 Chromium
|
|
23
|
-
class Service < WebDriver::Service
|
|
24
|
-
protected
|
|
25
|
-
|
|
26
|
-
def extract_service_args(driver_opts)
|
|
27
|
-
driver_args = super
|
|
28
|
-
driver_opts = driver_opts.dup
|
|
29
|
-
driver_args << "--log-path=#{driver_opts.delete(:log_path)}" if driver_opts.key?(:log_path)
|
|
30
|
-
driver_args << "--url-base=#{driver_opts.delete(:url_base)}" if driver_opts.key?(:url_base)
|
|
31
|
-
driver_args << "--port-server=#{driver_opts.delete(:port_server)}" if driver_opts.key?(:port_server)
|
|
32
|
-
if driver_opts.key?(:whitelisted_ips)
|
|
33
|
-
driver_args << "--whitelisted-ips=#{driver_opts.delete(:whitelisted_ips)}"
|
|
34
|
-
end
|
|
35
|
-
driver_args << '--verbose' if driver_opts.key?(:verbose)
|
|
36
|
-
driver_args << '--silent' if driver_opts.key?(:silent)
|
|
37
|
-
driver_args
|
|
38
|
-
end
|
|
39
|
-
end # Service
|
|
40
|
-
end # Chromium
|
|
41
|
-
end # WebDriver
|
|
42
|
-
end # Selenium
|
|
@@ -1,36 +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
|
-
# TODO: Deprecated; Delete after 4.0 release
|
|
21
|
-
module Selenium
|
|
22
|
-
module WebDriver
|
|
23
|
-
module DriverExtensions
|
|
24
|
-
module HasLocation
|
|
25
|
-
def location
|
|
26
|
-
raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting location'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def location=(*)
|
|
30
|
-
raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting location'
|
|
31
|
-
end
|
|
32
|
-
alias set_location location
|
|
33
|
-
end # HasLocation
|
|
34
|
-
end # DriverExtensions
|
|
35
|
-
end # WebDriver
|
|
36
|
-
end # Selenium
|
|
@@ -1,37 +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
|
-
# TODO: Deprecated; Delete after 4.0 release
|
|
21
|
-
module Selenium
|
|
22
|
-
module WebDriver
|
|
23
|
-
module DriverExtensions
|
|
24
|
-
module HasNetworkConnection
|
|
25
|
-
def network_connection_type
|
|
26
|
-
raise Error::UnsupportedOperationError,
|
|
27
|
-
'The W3C standard does not currently support getting network connection'
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def network_connection_type=(*)
|
|
31
|
-
raise Error::UnsupportedOperationError,
|
|
32
|
-
'The W3C standard does not currently support setting network connection'
|
|
33
|
-
end
|
|
34
|
-
end # HasNetworkConnection
|
|
35
|
-
end # DriverExtensions
|
|
36
|
-
end # WebDriver
|
|
37
|
-
end # Selenium
|