selenium-webdriver 4.52.0 → 4.53.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 +11 -0
- data/bin/linux-arm64/selenium-manager +0 -0
- data/bin/linux-x86_64/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/selenium-manager-THIRD-PARTY-NOTICES.txt +103 -63
- data/bin/selenium-manager.cdx.json +565 -640
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/server.rb +27 -75
- data/lib/selenium/webdriver/bidi/protocol/permissions.rb +3 -0
- data/lib/selenium/webdriver/bidi/protocol/session.rb +19 -0
- data/lib/selenium/webdriver/common/child_process.rb +3 -2
- data/lib/selenium/webdriver/common/service.rb +6 -2
- data/lib/selenium/webdriver/common/service_manager.rb +2 -0
- data/lib/selenium/webdriver/common/websocket_connection.rb +10 -7
- data/lib/selenium/webdriver/safari/service.rb +1 -1
- data/lib/selenium/webdriver/version.rb +1 -1
- metadata +2 -2
|
Binary file
|
data/lib/selenium/server.rb
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
require 'selenium/webdriver/common/child_process'
|
|
21
21
|
require 'selenium/webdriver/common/port_prober'
|
|
22
22
|
require 'selenium/webdriver/common/socket_poller'
|
|
23
|
+
require 'selenium/webdriver/common/selenium_manager'
|
|
23
24
|
require 'net/http'
|
|
24
25
|
require 'json'
|
|
25
26
|
|
|
@@ -32,9 +33,9 @@ module Selenium
|
|
|
32
33
|
# server = Selenium::Server.new('/path/to/selenium-server-standalone.jar')
|
|
33
34
|
# server.start
|
|
34
35
|
#
|
|
35
|
-
# Automatically download the given version:
|
|
36
|
+
# Automatically download the given version with Selenium Manager:
|
|
36
37
|
#
|
|
37
|
-
# server = Selenium::Server.get '
|
|
38
|
+
# server = Selenium::Server.get '4.30.0'
|
|
38
39
|
# server.start
|
|
39
40
|
#
|
|
40
41
|
# or the latest version:
|
|
@@ -57,8 +58,6 @@ module Selenium
|
|
|
57
58
|
class Server
|
|
58
59
|
class Error < StandardError; end
|
|
59
60
|
|
|
60
|
-
CL_RESET = WebDriver::Platform.windows? ? '' : "\r\e[0K"
|
|
61
|
-
|
|
62
61
|
class << self
|
|
63
62
|
#
|
|
64
63
|
# Download the given version of the selenium-server jar and return instance
|
|
@@ -73,92 +72,45 @@ module Selenium
|
|
|
73
72
|
end
|
|
74
73
|
|
|
75
74
|
#
|
|
76
|
-
# Download the given version of the selenium-server jar and return location
|
|
75
|
+
# Download the given version of the selenium-server jar with Selenium Manager and return location
|
|
77
76
|
#
|
|
78
77
|
# @param [String, Symbol] required_version X.Y.Z defaults to ':latest'
|
|
79
78
|
# @return [String] location of downloaded file
|
|
79
|
+
# @raise [Selenium::Server::Error] if Selenium Manager cannot provide the jar
|
|
80
80
|
#
|
|
81
81
|
|
|
82
82
|
def download(required_version = :latest)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
download_location = available_assets[download_file_name]['browser_download_url']
|
|
90
|
-
released = Net::HTTP.get_response(URI.parse(download_location))
|
|
91
|
-
redirected = URI.parse released.header['location']
|
|
92
|
-
|
|
93
|
-
File.open(download_file_name, 'wb') do |destination|
|
|
94
|
-
download_server(redirected, destination)
|
|
95
|
-
end
|
|
96
|
-
rescue StandardError
|
|
97
|
-
FileUtils.rm_rf download_file_name
|
|
98
|
-
raise
|
|
83
|
+
arguments = ['--grid']
|
|
84
|
+
unless required_version == :latest
|
|
85
|
+
download_file_name = "selenium-server-#{required_version}.jar"
|
|
86
|
+
return download_file_name if File.exist? download_file_name
|
|
87
|
+
|
|
88
|
+
arguments << required_version.to_s
|
|
99
89
|
end
|
|
100
90
|
|
|
91
|
+
cached_jar = WebDriver::SeleniumManager.binary_paths(*arguments)['driver_path']
|
|
92
|
+
if cached_jar.to_s.empty?
|
|
93
|
+
offline_source = ENV['SE_OFFLINE'] == 'true' ? 'SE_OFFLINE is true' : 'offline is true in se-config.toml'
|
|
94
|
+
message = "Selenium Manager is in offline mode (#{offline_source}) "
|
|
95
|
+
raise Error, message + "and has no cached selenium-server #{required_version}"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
download_file_name = File.basename(cached_jar)
|
|
99
|
+
FileUtils.cp(cached_jar, download_file_name) unless File.exist? download_file_name
|
|
100
|
+
|
|
101
101
|
download_file_name
|
|
102
|
+
rescue WebDriver::Error::WebDriverError => e
|
|
103
|
+
raise Error, e.message
|
|
102
104
|
end
|
|
103
105
|
|
|
104
106
|
#
|
|
105
|
-
#
|
|
107
|
+
# Download the latest selenium-server jar with Selenium Manager and return its version
|
|
108
|
+
#
|
|
109
|
+
# @return [String] X.Y.Z
|
|
106
110
|
#
|
|
107
111
|
|
|
108
112
|
def latest
|
|
109
|
-
|
|
110
|
-
available = available_assets.keys.map { |key| key[/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] }
|
|
111
|
-
available.map { |asset| Gem::Version.new(asset) }.max.to_s
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# @api private
|
|
116
|
-
|
|
117
|
-
def available_assets
|
|
118
|
-
@available_assets ||= net_http_start('api.github.com') do |http|
|
|
119
|
-
json = http.get('/repos/seleniumhq/selenium/releases').body
|
|
120
|
-
all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
|
|
121
|
-
server_assets = all_assets.select { |asset| asset['name'].match(/selenium-server-(\d+\.\d+\.\d+)\.jar/) }
|
|
122
|
-
server_assets.to_h { |asset| [asset.delete('name'), asset] }
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def net_http_start(address, &block)
|
|
127
|
-
http_proxy = ENV.fetch('http_proxy', nil) || ENV.fetch('HTTP_PROXY', nil)
|
|
128
|
-
if http_proxy
|
|
129
|
-
http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
|
|
130
|
-
uri = URI.parse(http_proxy)
|
|
131
|
-
|
|
132
|
-
Net::HTTP.start(address, nil, uri.host, uri.port, &block)
|
|
133
|
-
else
|
|
134
|
-
Net::HTTP.start(address, use_ssl: true, &block)
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def download_server(uri, destination)
|
|
139
|
-
net_http_start('github-releases.githubusercontent.com') do |http|
|
|
140
|
-
request = Net::HTTP::Get.new uri
|
|
141
|
-
resp = http.request(request) do |response|
|
|
142
|
-
total = response.content_length
|
|
143
|
-
progress = 0
|
|
144
|
-
segment_count = 0
|
|
145
|
-
|
|
146
|
-
response.read_body do |segment|
|
|
147
|
-
progress += segment.length
|
|
148
|
-
segment_count += 1
|
|
149
|
-
|
|
150
|
-
if (segment_count % 15).zero?
|
|
151
|
-
percent = progress.fdiv(total) * 100
|
|
152
|
-
print "#{CL_RESET}Downloading #{destination.path}: #{percent.to_i}% (#{progress} / #{total})"
|
|
153
|
-
segment_count = 0
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
destination.write(segment)
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
raise Error, "#{resp.code} for #{destination.path}" unless resp.is_a? Net::HTTPSuccess
|
|
161
|
-
end
|
|
113
|
+
download[/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1]
|
|
162
114
|
end
|
|
163
115
|
end
|
|
164
116
|
|
|
@@ -27,6 +27,7 @@ module Selenium
|
|
|
27
27
|
# @api private
|
|
28
28
|
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
|
|
29
29
|
class Permissions < Domain
|
|
30
|
+
# @see https://w3c.github.io/permissions/#cddl-type-permissions-permissionstate
|
|
30
31
|
PERMISSION_STATE = {
|
|
31
32
|
granted: 'granted',
|
|
32
33
|
denied: 'denied',
|
|
@@ -35,10 +36,12 @@ module Selenium
|
|
|
35
36
|
|
|
36
37
|
# @api private
|
|
37
38
|
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
|
|
39
|
+
# @see https://w3c.github.io/permissions/#cddl-type-permissions-permissiondescriptor
|
|
38
40
|
PermissionDescriptor = Serialization::Record.define(name: {wire_key: 'name', primitive: 'string'})
|
|
39
41
|
|
|
40
42
|
# @api private
|
|
41
43
|
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
|
|
44
|
+
# @see https://w3c.github.io/permissions/#cddl-type-permissions-setpermissionparameters
|
|
42
45
|
SetPermissionParameters = Serialization::Record.define(
|
|
43
46
|
descriptor: {wire_key: 'descriptor', ref: 'Permissions::PermissionDescriptor'},
|
|
44
47
|
state: {wire_key: 'state', enum: 'Permissions::PERMISSION_STATE'},
|
|
@@ -92,6 +92,25 @@ module Selenium
|
|
|
92
92
|
ref: 'Session::UserPromptHandler'
|
|
93
93
|
},
|
|
94
94
|
web_socket_url: {wire_key: 'webSocketUrl', required: false, primitive: 'string'},
|
|
95
|
+
moz_build_id: {wire_key: 'moz:buildID', required: false, primitive: 'string'},
|
|
96
|
+
moz_headless: {wire_key: 'moz:headless', required: false, primitive: 'boolean'},
|
|
97
|
+
moz_platform_version: {wire_key: 'moz:platformVersion', required: false, primitive: 'string'},
|
|
98
|
+
moz_process_id: {
|
|
99
|
+
wire_key: 'moz:processID',
|
|
100
|
+
required: false,
|
|
101
|
+
primitive: 'integer',
|
|
102
|
+
min: 0,
|
|
103
|
+
max: 9_007_199_254_740_991
|
|
104
|
+
},
|
|
105
|
+
moz_profile: {wire_key: 'moz:profile', required: false, primitive: 'string'},
|
|
106
|
+
moz_shutdown_timeout: {
|
|
107
|
+
wire_key: 'moz:shutdownTimeout',
|
|
108
|
+
required: false,
|
|
109
|
+
primitive: 'integer',
|
|
110
|
+
min: 0,
|
|
111
|
+
max: 9_007_199_254_740_991
|
|
112
|
+
},
|
|
113
|
+
moz_user_context: {wire_key: 'moz:userContext', required: false, primitive: 'string'},
|
|
95
114
|
extensible: true
|
|
96
115
|
)
|
|
97
116
|
|
|
@@ -32,7 +32,7 @@ module Selenium
|
|
|
32
32
|
|
|
33
33
|
POLL_INTERVAL = 0.1
|
|
34
34
|
|
|
35
|
-
attr_accessor :detach
|
|
35
|
+
attr_accessor :detach, :env
|
|
36
36
|
attr_writer :io
|
|
37
37
|
|
|
38
38
|
def self.build(*command)
|
|
@@ -44,6 +44,7 @@ module Selenium
|
|
|
44
44
|
@detach = false
|
|
45
45
|
@pid = nil
|
|
46
46
|
@status = nil
|
|
47
|
+
@env = nil
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def io
|
|
@@ -55,7 +56,7 @@ module Selenium
|
|
|
55
56
|
options[:pgroup] = true unless Platform.windows? # NOTE: this is a bug only in Windows 7
|
|
56
57
|
|
|
57
58
|
WebDriver.logger.debug("Starting process: #{@command} with #{options}", id: :process)
|
|
58
|
-
@pid = Process.spawn(*@command, options)
|
|
59
|
+
@pid = Process.spawn(@env || {}, *@command, options)
|
|
59
60
|
WebDriver.logger.debug(" -> pid: #{@pid}", id: :process)
|
|
60
61
|
|
|
61
62
|
Process.detach(@pid) if detach
|
|
@@ -57,16 +57,19 @@ module Selenium
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
attr_accessor :host, :executable_path, :port, :log, :args
|
|
60
|
+
attr_accessor :host, :executable_path, :port, :log, :args, :env
|
|
61
61
|
alias extra_args args
|
|
62
62
|
|
|
63
63
|
#
|
|
64
64
|
# End users should use a class method for the desired driver, rather than using this directly.
|
|
65
65
|
#
|
|
66
|
+
# @param env [Hash<String, String, nil>] environment variables for the driver process.
|
|
67
|
+
# These are merged into the inherited environment; set a value to nil to remove an inherited variable.
|
|
68
|
+
#
|
|
66
69
|
# @api private
|
|
67
70
|
#
|
|
68
71
|
|
|
69
|
-
def initialize(path: nil, port: nil, log: nil, args: nil)
|
|
72
|
+
def initialize(path: nil, port: nil, log: nil, args: nil, env: nil)
|
|
70
73
|
port ||= self.class::DEFAULT_PORT
|
|
71
74
|
args ||= []
|
|
72
75
|
|
|
@@ -82,6 +85,7 @@ module Selenium
|
|
|
82
85
|
log
|
|
83
86
|
end
|
|
84
87
|
@args = args
|
|
88
|
+
@env = env || {}
|
|
85
89
|
|
|
86
90
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
|
87
91
|
end
|
|
@@ -42,6 +42,7 @@ module Selenium
|
|
|
42
42
|
@port = config.port
|
|
43
43
|
@io = config.log
|
|
44
44
|
@extra_args = config.args
|
|
45
|
+
@env = config.env
|
|
45
46
|
@shutdown_supported = config.shutdown_supported
|
|
46
47
|
|
|
47
48
|
raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
|
|
@@ -80,6 +81,7 @@ module Selenium
|
|
|
80
81
|
def build_process(*command)
|
|
81
82
|
WebDriver.logger.debug("Executing Process #{command}", id: :driver_service)
|
|
82
83
|
@process = ChildProcess.build(*command)
|
|
84
|
+
@process.env = @env
|
|
83
85
|
if ENV.key?('SE_DEBUG')
|
|
84
86
|
if @io && @io != WebDriver.logger.io
|
|
85
87
|
WebDriver.logger.warn('SE_DEBUG is set; overriding user-specified driver log output to use stderr',
|
|
@@ -103,15 +103,18 @@ module Selenium
|
|
|
103
103
|
# IOError to match what writing to an already-closed socket raises
|
|
104
104
|
raise IOError, 'WebSocket connection is closed' if @closing
|
|
105
105
|
|
|
106
|
-
id
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
@messages_mtx.synchronize { pending_responses[id] = ConditionVariable.new }
|
|
106
|
+
# Callbacks send commands from their own threads, so the id must be
|
|
107
|
+
# allocated and registered atomically or two commands can share one
|
|
108
|
+
id = @messages_mtx.synchronize do
|
|
109
|
+
next_id.tap { |new_id| pending_responses[new_id] = ConditionVariable.new }
|
|
110
|
+
end
|
|
113
111
|
|
|
114
112
|
begin
|
|
113
|
+
data = payload.merge(id: id)
|
|
114
|
+
WebDriver.logger.debug('WebSocket ->', id: :ws) { data.to_s[...MAX_LOG_MESSAGE_SIZE] }
|
|
115
|
+
data = JSON.generate(data)
|
|
116
|
+
out_frame = WebSocket::Frame::Outgoing::Client.new(version: ws.version, data: data, type: 'text')
|
|
117
|
+
|
|
115
118
|
begin
|
|
116
119
|
socket.write(out_frame.to_s)
|
|
117
120
|
rescue *CONNECTION_ERRORS => e
|
|
@@ -25,7 +25,7 @@ module Selenium
|
|
|
25
25
|
EXECUTABLE = 'safaridriver'
|
|
26
26
|
SHUTDOWN_SUPPORTED = false
|
|
27
27
|
DRIVER_PATH_ENV_KEY = 'SE_SAFARIDRIVER'
|
|
28
|
-
def initialize(path: nil, port: nil, log: nil, args: nil)
|
|
28
|
+
def initialize(path: nil, port: nil, log: nil, args: nil, env: nil)
|
|
29
29
|
raise Error::WebDriverError, 'Safari Service does not support setting log output' if log
|
|
30
30
|
|
|
31
31
|
super
|
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.53.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: 2026-
|
|
13
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: base64
|