selenium-webdriver 4.44.0 → 4.46.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +19 -0
  3. data/Gemfile +1 -4
  4. data/README.md +1 -1
  5. data/bin/linux/selenium-manager +0 -0
  6. data/bin/macos/selenium-manager +0 -0
  7. data/bin/windows/selenium-manager.exe +0 -0
  8. data/lib/selenium/webdriver/atoms/findElements.js +272 -68
  9. data/lib/selenium/webdriver/atoms/getAttribute.js +152 -17
  10. data/lib/selenium/webdriver/atoms/isDisplayed.js +385 -39
  11. data/lib/selenium/webdriver/bidi/protocol/bluetooth.rb +465 -0
  12. data/lib/selenium/webdriver/bidi/protocol/browser.rb +222 -0
  13. data/lib/selenium/webdriver/bidi/protocol/browsing_context.rb +694 -0
  14. data/lib/selenium/webdriver/bidi/protocol/domain.rb +40 -0
  15. data/lib/selenium/webdriver/bidi/protocol/emulation.rb +334 -0
  16. data/lib/selenium/webdriver/bidi/protocol/input.rb +281 -0
  17. data/lib/selenium/webdriver/bidi/protocol/log.rb +104 -0
  18. data/lib/selenium/webdriver/bidi/protocol/network.rb +637 -0
  19. data/lib/selenium/webdriver/bidi/protocol/permissions.rb +73 -0
  20. data/lib/selenium/webdriver/bidi/protocol/script.rb +874 -0
  21. data/lib/selenium/webdriver/bidi/protocol/session.rb +241 -0
  22. data/lib/selenium/webdriver/bidi/protocol/speculation.rb +56 -0
  23. data/lib/selenium/webdriver/bidi/protocol/storage.rb +157 -0
  24. data/lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rb +83 -0
  25. data/lib/selenium/webdriver/bidi/protocol/web_extension.rb +93 -0
  26. data/lib/selenium/webdriver/bidi/protocol.rb +39 -0
  27. data/lib/selenium/webdriver/bidi/serialization/record.rb +226 -0
  28. data/lib/selenium/webdriver/bidi/serialization/union.rb +114 -0
  29. data/lib/selenium/webdriver/bidi/serialization.rb +78 -0
  30. data/lib/selenium/webdriver/bidi/support/bidi_generate.rb +936 -0
  31. data/lib/selenium/webdriver/bidi/support/check_generated.rb +55 -0
  32. data/lib/selenium/webdriver/bidi/transport.rb +52 -0
  33. data/lib/selenium/webdriver/bidi.rb +3 -0
  34. data/lib/selenium/webdriver/chrome/driver.rb +3 -3
  35. data/lib/selenium/webdriver/chromium/options.rb +3 -1
  36. data/lib/selenium/webdriver/chromium/profile.rb +6 -0
  37. data/lib/selenium/webdriver/common/client_config.rb +97 -0
  38. data/lib/selenium/webdriver/common/driver.rb +2 -2
  39. data/lib/selenium/webdriver/common/driver_finder.rb +32 -23
  40. data/lib/selenium/webdriver/common/local_driver.rb +19 -12
  41. data/lib/selenium/webdriver/common/proxy.rb +1 -1
  42. data/lib/selenium/webdriver/common/service.rb +1 -11
  43. data/lib/selenium/webdriver/common.rb +1 -0
  44. data/lib/selenium/webdriver/edge/driver.rb +3 -3
  45. data/lib/selenium/webdriver/firefox/driver.rb +3 -3
  46. data/lib/selenium/webdriver/ie/driver.rb +3 -3
  47. data/lib/selenium/webdriver/remote/bidi_bridge.rb +6 -1
  48. data/lib/selenium/webdriver/remote/bridge.rb +8 -10
  49. data/lib/selenium/webdriver/remote/driver.rb +12 -4
  50. data/lib/selenium/webdriver/remote/http/common.rb +25 -12
  51. data/lib/selenium/webdriver/remote/http/curb.rb +6 -8
  52. data/lib/selenium/webdriver/remote/http/default.rb +56 -39
  53. data/lib/selenium/webdriver/safari/driver.rb +3 -3
  54. data/lib/selenium/webdriver/safari/options.rb +8 -4
  55. data/lib/selenium/webdriver/safari.rb +1 -6
  56. data/lib/selenium/webdriver/support/guards/guard.rb +10 -11
  57. data/lib/selenium/webdriver/support/guards.rb +2 -1
  58. data/lib/selenium/webdriver/version.rb +1 -1
  59. data/selenium-webdriver.gemspec +1 -1
  60. metadata +27 -4
@@ -26,20 +26,18 @@ module Selenium
26
26
  #
27
27
  # An alternative to the default Net::HTTP client.
28
28
  #
29
- # This can be used for the Firefox and Remote drivers if you have Curb
30
- # installed.
31
- #
32
- # @example Using Curb
33
- # require 'selenium/webdriver/remote/http/curb'
34
- # include Selenium
35
- #
36
- # driver = WebDriver.for :firefox, :http_client => WebDriver::Remote::Http::Curb.new
29
+ # @deprecated Subclass {Selenium::WebDriver::Remote::Http::Common} to implement a custom HTTP client.
37
30
  #
38
31
 
39
32
  class Curb < Common
40
33
  attr_accessor :timeout
41
34
 
42
35
  def initialize(timeout: nil)
36
+ WebDriver.logger.deprecate(
37
+ 'Selenium::WebDriver::Remote::Http::Curb',
38
+ 'a custom subclass of Selenium::WebDriver::Remote::Http::Common',
39
+ id: :curb
40
+ )
43
41
  @timeout = timeout
44
42
  super()
45
43
  end
@@ -24,19 +24,41 @@ module Selenium
24
24
  module Http
25
25
  # @api private
26
26
  class Default < Common
27
- attr_writer :proxy
28
-
29
- attr_accessor :open_timeout, :read_timeout
30
-
31
27
  # Initializes object.
32
28
  # Warning: Setting {#open_timeout} to non-nil values will cause a separate thread to spawn.
33
29
  # Debuggers that freeze the process will not be able to evaluate any operations if that happens.
30
+ # @param [ClientConfig] client_config - Configuration used to build the HTTP client.
34
31
  # @param [Numeric] open_timeout - Open timeout to apply to HTTP client.
35
32
  # @param [Numeric] read_timeout - Read timeout (seconds) to apply to HTTP client.
36
- def initialize(open_timeout: nil, read_timeout: nil)
37
- @open_timeout = open_timeout
38
- @read_timeout = read_timeout
39
- super()
33
+ def initialize(client_config: nil, open_timeout: nil, read_timeout: nil)
34
+ if client_config && (open_timeout || read_timeout)
35
+ raise ArgumentError, 'Cannot use both :client_config and :open_timeout/:read_timeout'
36
+ end
37
+
38
+ client_config ||= ClientConfig.new
39
+ client_config.open_timeout = open_timeout if open_timeout
40
+ client_config.read_timeout = read_timeout if read_timeout
41
+ super(client_config: client_config)
42
+ end
43
+
44
+ def open_timeout
45
+ client_config.open_timeout
46
+ end
47
+
48
+ def read_timeout
49
+ client_config.read_timeout
50
+ end
51
+
52
+ def open_timeout=(value)
53
+ client_config.open_timeout = value
54
+ end
55
+
56
+ def read_timeout=(value)
57
+ client_config.read_timeout = value
58
+ end
59
+
60
+ def proxy=(value)
61
+ client_config.proxy = value
40
62
  end
41
63
 
42
64
  def close
@@ -94,16 +116,20 @@ module Selenium
94
116
  end
95
117
 
96
118
  if response.is_a? Net::HTTPRedirection
97
- WebDriver.logger.debug("Redirect to #{response['Location']}; times: #{redirects}")
98
- raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS
99
-
100
- request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
119
+ follow_redirect(response, redirects)
101
120
  else
102
121
  WebDriver.logger.debug(" <<< #{response.instance_variable_get(:@header).inspect}", id: :header)
103
122
  create_response response.code, response.body, response.content_type
104
123
  end
105
124
  end
106
125
 
126
+ def follow_redirect(response, redirects)
127
+ WebDriver.logger.debug("Redirect to #{response['Location']}; times: #{redirects}")
128
+ raise Error::WebDriverError, 'too many redirects' if redirects >= client_config.max_redirects
129
+
130
+ request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
131
+ end
132
+
107
133
  def new_request_for(verb, url, headers, payload)
108
134
  req = Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers)
109
135
 
@@ -120,52 +146,43 @@ module Selenium
120
146
 
121
147
  def new_http_client
122
148
  if use_proxy?
123
- url = @proxy.http
149
+ url = proxy.http
124
150
  unless proxy.respond_to?(:http) && url
125
151
  raise Error::WebDriverError,
126
- "expected HTTP proxy, got #{@proxy.inspect}"
152
+ "expected HTTP proxy, got #{proxy.inspect}"
127
153
  end
128
154
 
129
- proxy = URI.parse(url)
155
+ proxy_uri = URI.parse(url)
130
156
 
131
- Net::HTTP.new(server_url.host, server_url.port, proxy.host, proxy.port, proxy.user, proxy.password)
157
+ Net::HTTP.new(server_url.host, server_url.port,
158
+ proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
132
159
  else
133
160
  Net::HTTP.new server_url.host, server_url.port
134
161
  end
135
162
  end
136
163
 
137
164
  def proxy
138
- @proxy ||= begin
139
- proxy = ENV.fetch('http_proxy', nil) || ENV.fetch('HTTP_PROXY', nil)
140
- no_proxy = ENV.fetch('no_proxy', nil) || ENV.fetch('NO_PROXY', nil)
141
-
142
- if proxy
143
- proxy = "http://#{proxy}" unless proxy.start_with?('http://')
144
- Proxy.new(http: proxy, no_proxy: no_proxy)
145
- end
146
- end
165
+ client_config.proxy
147
166
  end
148
167
 
149
168
  def use_proxy?
150
169
  return false if proxy.nil?
170
+ return true unless proxy.no_proxy
151
171
 
152
- if proxy.no_proxy
153
- ignored = proxy.no_proxy.split(',').any? do |host|
154
- host == '*' ||
155
- host == server_url.host || (
156
- begin
157
- IPAddr.new(host).include?(server_url.host)
158
- rescue ArgumentError
159
- false
160
- end
161
- )
162
- end
172
+ !proxy_ignored?
173
+ end
163
174
 
164
- !ignored
165
- else
166
- true
175
+ def proxy_ignored?
176
+ proxy.no_proxy.split(',').map(&:strip).reject(&:empty?).any? do |host|
177
+ host == '*' || host == server_url.host || ip_match?(host)
167
178
  end
168
179
  end
180
+
181
+ def ip_match?(host)
182
+ IPAddr.new(host).include?(server_url.host)
183
+ rescue ArgumentError
184
+ false
185
+ end
169
186
  end # Default
170
187
  end # Http
171
188
  end # Remote
@@ -31,9 +31,9 @@ module Selenium
31
31
 
32
32
  include LocalDriver
33
33
 
34
- def initialize(options: nil, service: nil, url: nil, **)
35
- initialize_local_driver(options, service, url) do |caps, driver_url|
36
- super(caps: caps, url: driver_url, **)
34
+ def initialize(options: nil, service: nil, url: nil, http_client: nil, client_config: nil, **)
35
+ initialize_local_driver(options, service, url, http_client, client_config) do |caps, client|
36
+ super(caps: caps, http_client: client, **)
37
37
  end
38
38
  end
39
39
 
@@ -26,7 +26,8 @@ module Selenium
26
26
  # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
27
27
  CAPABILITIES = {automatic_inspection: 'safari:automaticInspection',
28
28
  automatic_profiling: 'safari:automaticProfiling'}.freeze
29
- BROWSER = Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
29
+ BROWSER = 'safari'
30
+ TECHNOLOGY_PREVIEW = 'Safari Technology Preview'
30
31
 
31
32
  def add_option(name, value = nil)
32
33
  key = name.is_a?(Hash) ? name.keys.first : name
@@ -35,9 +36,12 @@ module Selenium
35
36
  super
36
37
  end
37
38
 
38
- def as_json(*)
39
- @options[:browser_name] = Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
40
- super
39
+ def browser_name=(value)
40
+ @options[:browser_name] = value
41
+ end
42
+
43
+ def browser_name
44
+ @options[:browser_name] = Safari.technology_preview? ? TECHNOLOGY_PREVIEW : BROWSER
41
45
  end
42
46
  end # Options
43
47
  end # Safari
@@ -33,7 +33,6 @@ module Selenium
33
33
  end
34
34
 
35
35
  def technology_preview!
36
- Service.driver_path = technology_preview
37
36
  @use_technology_preview = true
38
37
  end
39
38
 
@@ -47,11 +46,7 @@ module Selenium
47
46
  end
48
47
 
49
48
  def path
50
- @path ||= '/Applications/Safari.app/Contents/MacOS/Safari'
51
- return @path if File.file?(@path) && File.executable?(@path)
52
- raise Error::WebDriverError, 'Safari is only supported on Mac' unless Platform.os.mac?
53
-
54
- raise Error::WebDriverError, 'Unable to find Safari'
49
+ @path ||= nil
55
50
  end
56
51
  end
57
52
  end # Safari
@@ -51,36 +51,35 @@ module Selenium
51
51
  end
52
52
 
53
53
  case type
54
- when :exclude
54
+ when :skip_if, :exclude
55
55
  "Test skipped because it breaks test run; #{details}"
56
56
  when :flaky
57
57
  "Test skipped because it is unreliable in this configuration; #{details}"
58
- when :exclusive
58
+ when :skip_unless, :exclusive
59
59
  "Test does not apply to this configuration; #{details}"
60
60
  else
61
61
  "Test guarded; #{details}"
62
62
  end
63
63
  end
64
64
 
65
- # Bug is present on all configurations specified
65
+ # Test is expected to fail on the configurations specified (marked pending).
66
66
  def except?
67
- @type == :except
67
+ @type == :pending_if || @type == :except
68
68
  end
69
69
 
70
- # Bug is present on all configurations not specified
70
+ # Test is expected to fail on every configuration except those specified (marked pending).
71
71
  def only?
72
- @type == :only
72
+ @type == :pending_unless || @type == :only
73
73
  end
74
74
 
75
- # Bug is present on all configurations specified, but test can not be run because it breaks other tests,
76
- # or it is flaky and unreliable
75
+ # Test is skipped on the configurations specified because it breaks the run or is unreliable.
77
76
  def exclude?
78
- @type == :exclude || @type == :flaky
77
+ @type == :skip_if || @type == :exclude || @type == :flaky
79
78
  end
80
79
 
81
- # Test only applies to configurations specified
80
+ # Test is skipped on every configuration except those specified (it only applies there).
82
81
  def exclusive?
83
- @type == :exclusive
82
+ @type == :skip_unless || @type == :exclusive
84
83
  end
85
84
  end # Guard
86
85
  end # Guards
@@ -24,7 +24,8 @@ module Selenium
24
24
  module WebDriver
25
25
  module Support
26
26
  class Guards
27
- GUARD_TYPES = %i[except only exclude exclusive flaky].freeze
27
+ GUARD_TYPES = %i[pending_if pending_unless skip_if skip_unless flaky
28
+ except only exclude exclusive].freeze
28
29
 
29
30
  attr_reader :messages
30
31
  attr_accessor :bug_tracker
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.44.0'
22
+ VERSION = '4.46.0'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  }
31
31
 
32
32
  s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
33
- s.required_ruby_version = Gem::Requirement.new('>= 3.2')
33
+ s.required_ruby_version = Gem::Requirement.new('>= 3.3')
34
34
 
35
35
  s.files = [
36
36
  'CHANGES',
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.44.0
4
+ version: 4.46.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-05-12 00:00:00.000000000 Z
13
+ date: 2026-07-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: base64
@@ -295,8 +295,30 @@ files:
295
295
  - lib/selenium/webdriver/bidi/network/intercepted_request.rb
296
296
  - lib/selenium/webdriver/bidi/network/intercepted_response.rb
297
297
  - lib/selenium/webdriver/bidi/network/url_pattern.rb
298
+ - lib/selenium/webdriver/bidi/protocol.rb
299
+ - lib/selenium/webdriver/bidi/protocol/bluetooth.rb
300
+ - lib/selenium/webdriver/bidi/protocol/browser.rb
301
+ - lib/selenium/webdriver/bidi/protocol/browsing_context.rb
302
+ - lib/selenium/webdriver/bidi/protocol/domain.rb
303
+ - lib/selenium/webdriver/bidi/protocol/emulation.rb
304
+ - lib/selenium/webdriver/bidi/protocol/input.rb
305
+ - lib/selenium/webdriver/bidi/protocol/log.rb
306
+ - lib/selenium/webdriver/bidi/protocol/network.rb
307
+ - lib/selenium/webdriver/bidi/protocol/permissions.rb
308
+ - lib/selenium/webdriver/bidi/protocol/script.rb
309
+ - lib/selenium/webdriver/bidi/protocol/session.rb
310
+ - lib/selenium/webdriver/bidi/protocol/speculation.rb
311
+ - lib/selenium/webdriver/bidi/protocol/storage.rb
312
+ - lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rb
313
+ - lib/selenium/webdriver/bidi/protocol/web_extension.rb
314
+ - lib/selenium/webdriver/bidi/serialization.rb
315
+ - lib/selenium/webdriver/bidi/serialization/record.rb
316
+ - lib/selenium/webdriver/bidi/serialization/union.rb
298
317
  - lib/selenium/webdriver/bidi/session.rb
299
318
  - lib/selenium/webdriver/bidi/struct.rb
319
+ - lib/selenium/webdriver/bidi/support/bidi_generate.rb
320
+ - lib/selenium/webdriver/bidi/support/check_generated.rb
321
+ - lib/selenium/webdriver/bidi/transport.rb
300
322
  - lib/selenium/webdriver/chrome.rb
301
323
  - lib/selenium/webdriver/chrome/driver.rb
302
324
  - lib/selenium/webdriver/chrome/features.rb
@@ -312,6 +334,7 @@ files:
312
334
  - lib/selenium/webdriver/common/action_builder.rb
313
335
  - lib/selenium/webdriver/common/alert.rb
314
336
  - lib/selenium/webdriver/common/child_process.rb
337
+ - lib/selenium/webdriver/common/client_config.rb
315
338
  - lib/selenium/webdriver/common/driver.rb
316
339
  - lib/selenium/webdriver/common/driver_extensions/downloads_files.rb
317
340
  - lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb
@@ -471,14 +494,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
471
494
  requirements:
472
495
  - - ">="
473
496
  - !ruby/object:Gem::Version
474
- version: '3.2'
497
+ version: '3.3'
475
498
  required_rubygems_version: !ruby/object:Gem::Requirement
476
499
  requirements:
477
500
  - - ">"
478
501
  - !ruby/object:Gem::Version
479
502
  version: 1.3.1
480
503
  requirements: []
481
- rubygems_version: 3.4.19
504
+ rubygems_version: 3.5.22
482
505
  signing_key:
483
506
  specification_version: 4
484
507
  summary: Selenium is a browser automation tool for automated testing of webapps and