selenium-webdriver 4.44.0 → 4.45.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.
@@ -28,6 +28,12 @@ module Selenium
28
28
  include ProfileHelper
29
29
 
30
30
  def initialize(model = nil)
31
+ WebDriver.logger.deprecate(
32
+ 'Chromium::Profile (including Chrome::Profile and Edge::Profile)',
33
+ "Options#add_argument('--user-data-dir=...'), Options#add_preference, and Options#add_extension",
34
+ id: :chromium_profile
35
+ )
36
+
31
37
  @model = verify_model(model)
32
38
  @extensions = []
33
39
  @encoded_extensions = []
@@ -26,6 +26,8 @@ module Selenium
26
26
  new(options, service_class.new).driver_path
27
27
  end
28
28
 
29
+ # @param options [Options, nil] when nil driver parsed from Service::EXECUTABLE
30
+ # @param service [Service]
29
31
  def initialize(options, service)
30
32
  @options = options
31
33
  @service = service
@@ -47,36 +49,43 @@ module Selenium
47
49
 
48
50
  def paths
49
51
  @paths ||= begin
50
- path = @service.class.driver_path
51
- path = path.call if path.is_a?(Proc)
52
- exe = @service.class::EXECUTABLE
53
- if path
54
- WebDriver.logger.debug("Skipping Selenium Manager; path to #{exe} specified in service class: #{path}")
55
- Platform.assert_executable(path)
56
- {driver_path: path}
57
- else
58
- output = SeleniumManager.binary_paths(*to_args)
59
- formatted = {driver_path: Platform.cygwin_path(output['driver_path'], only_cygwin: true),
60
- browser_path: Platform.cygwin_path(output['browser_path'], only_cygwin: true)}
61
- Platform.assert_executable(formatted[:driver_path])
62
-
63
- browser_path = formatted[:browser_path]
64
- Platform.assert_executable(browser_path)
65
- if @options.respond_to?(:binary) && @options.binary.nil?
66
- @options.binary = browser_path
67
- @options.browser_version = nil
68
- end
69
-
70
- formatted
71
- end
52
+ path = @service.executable_path || env_path || class_path
53
+ path ? paths_from_service(path) : paths_from_manager
72
54
  rescue StandardError => e
73
55
  WebDriver.logger.error("Exception occurred: #{e.message}")
74
56
  WebDriver.logger.error("Backtrace:\n\t#{e.backtrace&.join("\n\t")}")
75
- raise Error::NoSuchDriverError, "Unable to obtain #{exe}"
57
+ raise Error::NoSuchDriverError, "Unable to obtain #{@service.class::EXECUTABLE}"
76
58
  end
77
59
  end
78
60
 
61
+ def env_path
62
+ ENV.fetch(@service.class::DRIVER_PATH_ENV_KEY, nil)
63
+ end
64
+
65
+ def class_path
66
+ path = @service.class.driver_path
67
+ path.is_a?(Proc) ? path.call : path
68
+ end
69
+
70
+ def paths_from_service(path)
71
+ exe = @service.class::EXECUTABLE
72
+ WebDriver.logger.debug("Skipping Selenium Manager; path to #{exe} specified in service class: #{path}")
73
+ Platform.assert_executable(path)
74
+ {driver_path: path}
75
+ end
76
+
77
+ def paths_from_manager
78
+ output = SeleniumManager.binary_paths(*to_args)
79
+ formatted = {driver_path: Platform.cygwin_path(output['driver_path'], only_cygwin: true),
80
+ browser_path: Platform.cygwin_path(output['browser_path'], only_cygwin: true)}
81
+ Platform.assert_executable(formatted[:driver_path])
82
+ Platform.assert_executable(formatted[:browser_path])
83
+ formatted
84
+ end
85
+
79
86
  def to_args
87
+ return ['--driver', @service.class::EXECUTABLE] unless @options
88
+
80
89
  args = ['--browser', @options.browser_name]
81
90
  if @options.browser_version
82
91
  args << '--browser-version'
@@ -48,14 +48,10 @@ module Selenium
48
48
  raise ArgumentError, ":options must be an instance of #{default_options.class}"
49
49
  end
50
50
 
51
- service.executable_path ||= begin
52
- finder = WebDriver::DriverFinder.new(options, service)
53
- if options.respond_to?(:binary) && finder.browser_path?
54
- options.binary = finder.browser_path
55
- options.browser_version = nil
56
- end
57
- finder.driver_path
58
- end
51
+ finder = WebDriver::DriverFinder.new(options, service)
52
+ options.binary = finder.browser_path if options.respond_to?(:binary) && finder.browser_path?
53
+ service.executable_path = finder.driver_path
54
+ options.browser_version = nil if options.respond_to?(:binary) && options.binary
59
55
  options.as_json
60
56
  end
61
57
  end
@@ -69,7 +69,6 @@ module Selenium
69
69
  def initialize(path: nil, port: nil, log: nil, args: nil)
70
70
  port ||= self.class::DEFAULT_PORT
71
71
  args ||= []
72
- path ||= env_path
73
72
 
74
73
  @executable_path = path
75
74
  @host = Platform.localhost
@@ -88,7 +87,7 @@ module Selenium
88
87
  end
89
88
 
90
89
  def launch
91
- @executable_path ||= env_path || find_driver_path
90
+ @executable_path ||= DriverFinder.new(nil, self).driver_path
92
91
  ServiceManager.new(self).tap(&:start)
93
92
  end
94
93
 
@@ -96,15 +95,6 @@ module Selenium
96
95
  self.class::SHUTDOWN_SUPPORTED
97
96
  end
98
97
 
99
- def find_driver_path
100
- default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new
101
- DriverFinder.new(default_options, self).driver_path
102
- end
103
-
104
- def env_path
105
- ENV.fetch(self.class::DRIVER_PATH_ENV_KEY, nil)
106
- end
107
-
108
98
  private
109
99
 
110
100
  def warn_driver_log_override
@@ -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
@@ -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.45.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.45.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-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: base64
@@ -471,14 +471,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
471
471
  requirements:
472
472
  - - ">="
473
473
  - !ruby/object:Gem::Version
474
- version: '3.2'
474
+ version: '3.3'
475
475
  required_rubygems_version: !ruby/object:Gem::Requirement
476
476
  requirements:
477
477
  - - ">"
478
478
  - !ruby/object:Gem::Version
479
479
  version: 1.3.1
480
480
  requirements: []
481
- rubygems_version: 3.4.19
481
+ rubygems_version: 3.5.22
482
482
  signing_key:
483
483
  specification_version: 4
484
484
  summary: Selenium is a browser automation tool for automated testing of webapps and