selenium-webdriver 4.31.0 → 4.33.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +18 -0
  3. data/README.md +1 -1
  4. data/bin/linux/selenium-manager +0 -0
  5. data/bin/macos/selenium-manager +0 -0
  6. data/bin/windows/selenium-manager.exe +0 -0
  7. data/lib/selenium/webdriver/atoms.rb +2 -2
  8. data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +2 -2
  9. data/lib/selenium/webdriver/chrome/driver.rb +2 -2
  10. data/lib/selenium/webdriver/chromium/options.rb +2 -2
  11. data/lib/selenium/webdriver/common/driver.rb +8 -8
  12. data/lib/selenium/webdriver/common/interactions/key_actions.rb +4 -4
  13. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +10 -10
  14. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +6 -6
  15. data/lib/selenium/webdriver/common/options.rb +11 -11
  16. data/lib/selenium/webdriver/common/print_options.rb +93 -0
  17. data/lib/selenium/webdriver/common/selenium_manager.rb +36 -17
  18. data/lib/selenium/webdriver/common/service.rb +10 -10
  19. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +4 -4
  20. data/lib/selenium/webdriver/common.rb +1 -0
  21. data/lib/selenium/webdriver/edge/driver.rb +2 -2
  22. data/lib/selenium/webdriver/firefox/driver.rb +2 -2
  23. data/lib/selenium/webdriver/firefox/options.rb +2 -2
  24. data/lib/selenium/webdriver/firefox/service.rb +9 -0
  25. data/lib/selenium/webdriver/ie/driver.rb +2 -2
  26. data/lib/selenium/webdriver/remote/driver.rb +2 -2
  27. data/lib/selenium/webdriver/safari/driver.rb +2 -2
  28. data/lib/selenium/webdriver/support/block_event_listener.rb +2 -2
  29. data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -3
  30. data/lib/selenium/webdriver/support/guards.rb +3 -1
  31. data/lib/selenium/webdriver/version.rb +1 -1
  32. data/lib/selenium/webdriver.rb +4 -5
  33. data/selenium-webdriver.gemspec +5 -5
  34. metadata +13 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 306139ef10e16f70cf3a8b0514c352d66a72d2a9a5a9ab55163ebce457b31519
4
- data.tar.gz: db1efc1750fffe9d5dc11e6740c9e27f7c63fb6a268f10f35071ba6629d3dc17
3
+ metadata.gz: 3fd4b623fa86d431079ad03fad528adf52a72f477333c14ed0ed36741a4f41e6
4
+ data.tar.gz: 214779166b857477353b6e9b2ebc200287a6735329cfc59f734af42bff23332f
5
5
  SHA512:
6
- metadata.gz: 9e1af03b2cc953b0bf3fc89e651440f2586f307ecd7b971623a86f3ae19f7a24e26e330cd46bc767af93dd00e9a9654968eefb07d0ee22fbe855f40a8012fd85
7
- data.tar.gz: 11de4e8e2e1a5003dc8dc89625c5621afba8666ec9deea7e283931dfb9cdf6be1745b8b00701c1428b1210e7847e07405abd97e44d1673a21ba837091b1659b9
6
+ metadata.gz: 24f46301be793d2a21a347a75f5aafa0cc7aac2c82ee504f34cc6dad76047ef6831cb57724f7c02c4efee1debf39dfa7dc2dade342c3c0945b004b7a9651f617
7
+ data.tar.gz: 9a711961bb2b3925cfb4b47a35c0cc15c47bb4b5d8480213f5ba6010e94bca64e539050f9007e7b0ef2f7e0f407bee0db0830bf970b7b1ed23b40ccba5e76ff4
data/CHANGES CHANGED
@@ -1,3 +1,21 @@
1
+ 4.33.0 (2025-05-23)
2
+ =========================
3
+ * Add CDP for Chrome 137 and remove 134
4
+ * Let firefox choose the bidi port by default (#15727)
5
+ * Upgrade to Ruby 3.2
6
+
7
+ 4.32.0 (2025-05-02)
8
+ =========================
9
+ * Add CDP for Chrome 136 and remove 133
10
+ * log at info level with names and values when Guards#add_condition used
11
+ * Add PrintOptions Implementation for Ruby WebDriver (#15158)
12
+ * [ruby] fix lint for print_options.rb (#15608)
13
+ * add enable_downloads to attr_accessor for all options classes
14
+ * make logging of test guards debug level not info
15
+ * Set remote active protocol in Firefox to BiDi only
16
+ * handle issue with selenium manager exit status being nil (#15676)
17
+ * Add websocket-port parameter to firefox service (#15458)
18
+
1
19
  4.31.0 (2025-04-04)
2
20
  =========================
3
21
  * Add support for 135 and remove 132
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # selenium-webdriver
2
2
 
3
- This gem provides Ruby bindings for Selenium and supports MRI >= 3.1.
3
+ This gem provides Ruby bindings for Selenium and supports MRI >= 3.2.
4
4
 
5
5
  ## Install
6
6
 
Binary file
Binary file
Binary file
@@ -31,8 +31,8 @@ module Selenium
31
31
  File.read(File.expand_path("../atoms/#{function}.js", __FILE__))
32
32
  end
33
33
 
34
- def execute_atom(function_name, *arguments)
35
- execute_script(atom_script(function_name), *arguments)
34
+ def execute_atom(function_name, *)
35
+ execute_script(atom_script(function_name), *)
36
36
  end
37
37
  end # Atoms
38
38
  end # WebDriver
@@ -23,8 +23,8 @@ module Selenium
23
23
  class ConsoleLogEntry < GenericLogEntry
24
24
  attr_accessor :method, :realm, :args
25
25
 
26
- def initialize(method:, realm:, args:, **opts)
27
- super(**opts)
26
+ def initialize(method:, realm:, args:, **)
27
+ super(**)
28
28
  @method = method
29
29
  @realm = realm
30
30
  @args = args
@@ -30,9 +30,9 @@ module Selenium
30
30
  class Driver < Chromium::Driver
31
31
  include LocalDriver
32
32
 
33
- def initialize(options: nil, service: nil, url: nil, **opts)
33
+ def initialize(options: nil, service: nil, url: nil, **)
34
34
  caps, url = initialize_local_driver(options, service, url)
35
- super(caps: caps, url: url, **opts)
35
+ super(caps: caps, url: url, **)
36
36
  end
37
37
 
38
38
  def browser
@@ -67,8 +67,8 @@ module Selenium
67
67
  # @option opts [Array<String>] window_types A list of window types to appear in the list of window handles
68
68
  #
69
69
 
70
- def initialize(profile: nil, **opts)
71
- super(**opts)
70
+ def initialize(profile: nil, **)
71
+ super(**)
72
72
 
73
73
  @profile = profile
74
74
 
@@ -68,9 +68,9 @@ module Selenium
68
68
  # @api private
69
69
  #
70
70
 
71
- def initialize(bridge: nil, listener: nil, **opts)
71
+ def initialize(bridge: nil, listener: nil, **)
72
72
  @devtools = nil
73
- bridge ||= create_bridge(**opts)
73
+ bridge ||= create_bridge(**)
74
74
  @bridge = listener ? Support::EventFiringBridge.new(bridge, listener) : bridge
75
75
  add_extensions(@bridge.browser)
76
76
  end
@@ -131,8 +131,8 @@ module Selenium
131
131
  # @see ActionBuilder
132
132
  #
133
133
 
134
- def action(**opts)
135
- bridge.action(**opts)
134
+ def action(**)
135
+ bridge.action(**)
136
136
  end
137
137
 
138
138
  #
@@ -225,8 +225,8 @@ module Selenium
225
225
  # The value returned from the script.
226
226
  #
227
227
 
228
- def execute_script(script, *args)
229
- bridge.execute_script(script, *args)
228
+ def execute_script(script, *)
229
+ bridge.execute_script(script, *)
230
230
  end
231
231
 
232
232
  # Execute an asynchronous piece of JavaScript in the context of the
@@ -244,8 +244,8 @@ module Selenium
244
244
  # @return [WebDriver::Element,Integer,Float,Boolean,NilClass,String,Array]
245
245
  #
246
246
 
247
- def execute_async_script(script, *args)
248
- bridge.execute_async_script(script, *args)
247
+ def execute_async_script(script, *)
248
+ bridge.execute_async_script(script, *)
249
249
  end
250
250
 
251
251
  #
@@ -44,8 +44,8 @@ module Selenium
44
44
  # @return [ActionBuilder] A self reference
45
45
  #
46
46
 
47
- def key_down(*args, device: nil)
48
- key_action(*args, action: :create_key_down, device: device)
47
+ def key_down(*, device: nil)
48
+ key_action(*, action: :create_key_down, device: device)
49
49
  end
50
50
 
51
51
  #
@@ -71,8 +71,8 @@ module Selenium
71
71
  # @return [ActionBuilder] A self reference
72
72
  #
73
73
 
74
- def key_up(*args, device: nil)
75
- key_action(*args, action: :create_key_up, device: device)
74
+ def key_up(*, device: nil)
75
+ key_action(*, action: :create_key_up, device: device)
76
76
  end
77
77
 
78
78
  #
@@ -46,8 +46,8 @@ module Selenium
46
46
  # @return [ActionBuilder] A self reference.
47
47
  #
48
48
 
49
- def pointer_down(button = :left, device: nil, **opts)
50
- button_action(button, :create_pointer_down, device: device, **opts)
49
+ def pointer_down(button = :left, device: nil, **)
50
+ button_action(button, :create_pointer_down, device: device, **)
51
51
  end
52
52
 
53
53
  #
@@ -63,8 +63,8 @@ module Selenium
63
63
  # @return [ActionBuilder] A self reference.
64
64
  #
65
65
 
66
- def pointer_up(button = :left, device: nil, **opts)
67
- button_action(button, :create_pointer_up, device: device, **opts)
66
+ def pointer_up(button = :left, device: nil, **)
67
+ button_action(button, :create_pointer_up, device: device, **)
68
68
  end
69
69
 
70
70
  #
@@ -122,13 +122,13 @@ module Selenium
122
122
  # @raise [MoveTargetOutOfBoundsError] if the provided offset is outside the document's boundaries.
123
123
  #
124
124
 
125
- def move_by(right_by, down_by, device: nil, duration: default_move_duration, **opts)
125
+ def move_by(right_by, down_by, device: nil, duration: default_move_duration, **)
126
126
  pointer = pointer_input(device)
127
127
  pointer.create_pointer_move(duration: duration,
128
128
  x: Integer(right_by),
129
129
  y: Integer(down_by),
130
130
  origin: Interactions::PointerMove::POINTER,
131
- **opts)
131
+ **)
132
132
  tick(pointer)
133
133
  self
134
134
  end
@@ -150,13 +150,13 @@ module Selenium
150
150
  # @raise [MoveTargetOutOfBoundsError] if the provided x or y value is outside the document's boundaries.
151
151
  #
152
152
 
153
- def move_to_location(x, y, device: nil, duration: default_move_duration, **opts)
153
+ def move_to_location(x, y, device: nil, duration: default_move_duration, **)
154
154
  pointer = pointer_input(device)
155
155
  pointer.create_pointer_move(duration: duration,
156
156
  x: Integer(x),
157
157
  y: Integer(y),
158
158
  origin: Interactions::PointerMove::VIEWPORT,
159
- **opts)
159
+ **)
160
160
  tick(pointer)
161
161
  self
162
162
  end
@@ -336,9 +336,9 @@ module Selenium
336
336
 
337
337
  private
338
338
 
339
- def button_action(button, action, device: nil, **opts)
339
+ def button_action(button, action, device: nil, **)
340
340
  pointer = pointer_input(device)
341
- pointer.send(action, button, **opts)
341
+ pointer.send(action, button, **)
342
342
  tick(pointer)
343
343
  self
344
344
  end
@@ -49,16 +49,16 @@ module Selenium
49
49
  KIND[pointer]
50
50
  end
51
51
 
52
- def create_pointer_move(duration: 0, x: 0, y: 0, origin: nil, **opts)
53
- add_action(PointerMove.new(self, duration, x, y, origin: origin, **opts))
52
+ def create_pointer_move(duration: 0, x: 0, y: 0, origin: nil, **)
53
+ add_action(PointerMove.new(self, duration, x, y, origin: origin, **))
54
54
  end
55
55
 
56
- def create_pointer_down(button, **opts)
57
- add_action(PointerPress.new(self, :down, button, **opts))
56
+ def create_pointer_down(button, **)
57
+ add_action(PointerPress.new(self, :down, button, **))
58
58
  end
59
59
 
60
- def create_pointer_up(button, **opts)
61
- add_action(PointerPress.new(self, :up, button, **opts))
60
+ def create_pointer_up(button, **)
61
+ add_action(PointerPress.new(self, :up, button, **))
62
62
  end
63
63
 
64
64
  def create_pointer_cancel
@@ -29,30 +29,30 @@ module Selenium
29
29
  class << self
30
30
  attr_reader :driver_path
31
31
 
32
- def chrome(**opts)
33
- Chrome::Options.new(**opts)
32
+ def chrome(**)
33
+ Chrome::Options.new(**)
34
34
  end
35
35
 
36
- def firefox(**opts)
37
- Firefox::Options.new(**opts)
36
+ def firefox(**)
37
+ Firefox::Options.new(**)
38
38
  end
39
39
 
40
- def ie(**opts)
41
- IE::Options.new(**opts)
40
+ def ie(**)
41
+ IE::Options.new(**)
42
42
  end
43
43
  alias internet_explorer ie
44
44
 
45
- def edge(**opts)
46
- Edge::Options.new(**opts)
45
+ def edge(**)
46
+ Edge::Options.new(**)
47
47
  end
48
48
  alias microsoftedge edge
49
49
 
50
- def safari(**opts)
51
- Safari::Options.new(**opts)
50
+ def safari(**)
51
+ Safari::Options.new(**)
52
52
  end
53
53
 
54
54
  def set_capabilities
55
- (W3C_OPTIONS + self::CAPABILITIES.keys).each do |key|
55
+ (W3C_OPTIONS + GRID_OPTIONS + self::CAPABILITIES.keys).each do |key|
56
56
  next if method_defined? key
57
57
 
58
58
  define_method key do
@@ -0,0 +1,93 @@
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
+ # Represents options for printing a page.
23
+ class PrintOptions
24
+ DEFAULT_SCALE = 1.0
25
+ DEFAULT_ORIENTATION = 'portrait'
26
+ DEFAULT_PAGE_SIZE = {width: 21.0, height: 29.7}.freeze # A4 size in cm
27
+ DEFAULT_MARGINS = {top: 1.0, bottom: 1.0, left: 1.0, right: 1.0}.freeze
28
+
29
+ attr_accessor :orientation, :scale, :background, :page_ranges, :margins
30
+
31
+ def initialize
32
+ @orientation = DEFAULT_ORIENTATION
33
+ @scale = DEFAULT_SCALE
34
+ @background = false
35
+ @page_ranges = nil
36
+ @page_size = DEFAULT_PAGE_SIZE
37
+ @margins = DEFAULT_MARGINS
38
+ end
39
+
40
+ # Converts the options to a hash format to be used by WebDriver.
41
+ #
42
+ # @return [Hash]
43
+ def to_h
44
+ options = {
45
+ orientation: @orientation,
46
+ scale: @scale,
47
+ background: @background,
48
+ pageRanges: @page_ranges,
49
+ paperWidth: @page_size[:width],
50
+ paperHeight: @page_size[:height],
51
+ marginTop: @margins[:top],
52
+ marginBottom: @margins[:bottom],
53
+ marginLeft: @margins[:left],
54
+ marginRight: @margins[:right]
55
+ }
56
+
57
+ options.compact
58
+ end
59
+
60
+ # Gets the current page size.
61
+ #
62
+ # @return [Hash] The current page size hash with :width and :height.
63
+ attr_reader :page_size
64
+
65
+ # Sets the page size. Can be a predefined symbol or custom size hash.
66
+ #
67
+ # @param [Symbol, Hash] value The predefined size (:letter, :legal, :a4, :tabloid) or a custom hash.
68
+ def page_size=(value)
69
+ predefined_sizes = {
70
+ letter: {width: 21.59, height: 27.94},
71
+ legal: {width: 21.59, height: 35.56},
72
+ a4: {width: 21.0, height: 29.7},
73
+ tabloid: {width: 27.94, height: 43.18}
74
+ }
75
+
76
+ case value
77
+ when Symbol
78
+ raise ArgumentError, "Invalid page size: #{value}" unless predefined_sizes.key?(value)
79
+
80
+ @page_size = predefined_sizes[value]
81
+ when Hash
82
+ unless value.key?(:width) && value.key?(:height)
83
+ raise ArgumentError, 'Custom page size must include :width and :height'
84
+ end
85
+
86
+ @page_size = value
87
+ else
88
+ raise ArgumentError, 'Page size must be a Symbol or a Hash'
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -61,25 +61,12 @@ module Selenium
61
61
  end
62
62
 
63
63
  def run(*command)
64
- WebDriver.logger.debug("Executing Process #{command}", id: :selenium_manager)
65
-
66
- begin
67
- stdout, stderr, status = Open3.capture3(*command)
68
- rescue StandardError => e
69
- raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
70
- end
64
+ stdout, stderr, status = execute_command(*command)
65
+ result = parse_result_and_log(stdout)
71
66
 
72
- json_output = stdout.empty? ? {'logs' => [], 'result' => {}} : JSON.parse(stdout)
73
- json_output['logs'].each do |log|
74
- level = log['level'].casecmp('info').zero? ? 'debug' : log['level'].downcase
75
- WebDriver.logger.send(level, log['message'], id: :selenium_manager)
76
- end
67
+ validate_command_result(command, status, result, stderr)
77
68
 
78
- result = json_output['result']
79
- return result unless status.exitstatus.positive? || result.nil?
80
-
81
- raise Error::WebDriverError,
82
- "Unsuccessful command executed: #{command} - Code #{status.exitstatus}\n#{result}\n#{stderr}"
69
+ result
83
70
  end
84
71
 
85
72
  def platform_location
@@ -98,6 +85,38 @@ module Selenium
98
85
  raise Error::WebDriverError, "unsupported platform: #{Platform.os}"
99
86
  end
100
87
  end
88
+
89
+ def execute_command(*command)
90
+ WebDriver.logger.debug("Executing Process #{command}", id: :selenium_manager)
91
+
92
+ Open3.capture3(*command)
93
+ rescue StandardError => e
94
+ raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
95
+ end
96
+
97
+ def parse_result_and_log(stdout)
98
+ json_output = stdout.empty? ? {'logs' => [], 'result' => {}} : JSON.parse(stdout)
99
+
100
+ json_output['logs'].each do |log|
101
+ level = log['level'].casecmp('info').zero? ? 'debug' : log['level'].downcase
102
+ WebDriver.logger.send(level, log['message'], id: :selenium_manager)
103
+ end
104
+
105
+ json_output['result']
106
+ end
107
+
108
+ def validate_command_result(command, status, result, stderr)
109
+ if status.nil? || status.exitstatus.nil?
110
+ WebDriver.logger.info("No exit status for: #{command}. Assuming success if result is present.",
111
+ id: :selenium_manager)
112
+ end
113
+
114
+ return unless status&.exitstatus&.positive? || result.nil?
115
+
116
+ code = status&.exitstatus || 'exit status not available'
117
+ raise Error::WebDriverError,
118
+ "Unsuccessful command executed: #{command} - Code #{code}\n#{result}\n#{stderr}"
119
+ end
101
120
  end
102
121
  end # SeleniumManager
103
122
  end # WebDriver
@@ -28,27 +28,27 @@ module Selenium
28
28
  class << self
29
29
  attr_reader :driver_path
30
30
 
31
- def chrome(**opts)
32
- Chrome::Service.new(**opts)
31
+ def chrome(**)
32
+ Chrome::Service.new(**)
33
33
  end
34
34
 
35
- def firefox(**opts)
36
- Firefox::Service.new(**opts)
35
+ def firefox(**)
36
+ Firefox::Service.new(**)
37
37
  end
38
38
 
39
- def ie(**opts)
40
- IE::Service.new(**opts)
39
+ def ie(**)
40
+ IE::Service.new(**)
41
41
  end
42
42
  alias internet_explorer ie
43
43
 
44
- def edge(**opts)
45
- Edge::Service.new(**opts)
44
+ def edge(**)
45
+ Edge::Service.new(**)
46
46
  end
47
47
  alias microsoftedge edge
48
48
  alias msedge edge
49
49
 
50
- def safari(**opts)
51
- Safari::Service.new(**opts)
50
+ def safari(**)
51
+ Safari::Service.new(**)
52
52
  end
53
53
 
54
54
  def driver_path=(path)
@@ -26,12 +26,12 @@ module Selenium
26
26
  module WebDriver
27
27
  class Credential
28
28
  class << self
29
- def resident(**opts)
30
- Credential.new(resident_credential: true, **opts)
29
+ def resident(**)
30
+ Credential.new(resident_credential: true, **)
31
31
  end
32
32
 
33
- def non_resident(**opts)
34
- Credential.new(resident_credential: false, **opts)
33
+ def non_resident(**)
34
+ Credential.new(resident_credential: false, **)
35
35
  end
36
36
 
37
37
  def encode(byte_array)
@@ -87,6 +87,7 @@ require 'selenium/webdriver/common/driver_extensions/has_casting'
87
87
  require 'selenium/webdriver/common/driver_extensions/has_launching'
88
88
  require 'selenium/webdriver/common/driver_extensions/has_fedcm_dialog'
89
89
  require 'selenium/webdriver/common/keys'
90
+ require 'selenium/webdriver/common/print_options'
90
91
  require 'selenium/webdriver/common/profile_helper'
91
92
  require 'selenium/webdriver/common/options'
92
93
  require 'selenium/webdriver/common/takes_screenshot'
@@ -30,9 +30,9 @@ module Selenium
30
30
  class Driver < Chromium::Driver
31
31
  include LocalDriver
32
32
 
33
- def initialize(options: nil, service: nil, url: nil, **opts)
33
+ def initialize(options: nil, service: nil, url: nil, **)
34
34
  caps, url = initialize_local_driver(options, service, url)
35
- super(caps: caps, url: url, **opts)
35
+ super(caps: caps, url: url, **)
36
36
  end
37
37
 
38
38
  def browser
@@ -36,9 +36,9 @@ module Selenium
36
36
 
37
37
  include LocalDriver
38
38
 
39
- def initialize(options: nil, service: nil, url: nil, **opts)
39
+ def initialize(options: nil, service: nil, url: nil, **)
40
40
  caps, url = initialize_local_driver(options, service, url)
41
- super(caps: caps, url: url, **opts)
41
+ super(caps: caps, url: url, **)
42
42
  end
43
43
 
44
44
  def browser
@@ -64,9 +64,9 @@ module Selenium
64
64
 
65
65
  @options[:args] ||= []
66
66
  @options[:prefs] ||= {}
67
- # Firefox 129 onwards the CDP protocol will not be enabled by default. Setting this preference will enable it.
68
67
  # https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/.
69
- @options[:prefs]['remote.active-protocols'] = 3
68
+ # Enable BiDi only
69
+ @options[:prefs]['remote.active-protocols'] = 1
70
70
  @options[:env] ||= {}
71
71
  @options[:log] ||= {level: log_level} if log_level
72
72
 
@@ -25,6 +25,15 @@ module Selenium
25
25
  EXECUTABLE = 'geckodriver'
26
26
  SHUTDOWN_SUPPORTED = false
27
27
  DRIVER_PATH_ENV_KEY = 'SE_GECKODRIVER'
28
+
29
+ def initialize(path: nil, port: nil, log: nil, args: nil)
30
+ args ||= []
31
+ unless args.any? { |arg| arg.include?('--connect-existing') || arg.include?('--websocket-port') }
32
+ args << '--websocket-port'
33
+ args << '0'
34
+ end
35
+ super
36
+ end
28
37
  end # Service
29
38
  end # Firefox
30
39
  end # WebDriver
@@ -31,9 +31,9 @@ module Selenium
31
31
 
32
32
  include LocalDriver
33
33
 
34
- def initialize(options: nil, service: nil, url: nil, **opts)
34
+ def initialize(options: nil, service: nil, url: nil, **)
35
35
  caps, url = initialize_local_driver(options, service, url)
36
- super(caps: caps, url: url, **opts)
36
+ super(caps: caps, url: url, **)
37
37
  end
38
38
 
39
39
  def browser
@@ -30,12 +30,12 @@ module Selenium
30
30
  include DriverExtensions::HasSessionId
31
31
  include DriverExtensions::HasFileDownloads
32
32
 
33
- def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
33
+ def initialize(capabilities: nil, options: nil, service: nil, url: nil, **)
34
34
  raise ArgumentError, "Can not set :service object on #{self.class}" if service
35
35
 
36
36
  url ||= "http://#{Platform.localhost}:4444/wd/hub"
37
37
  caps = process_options(options, capabilities)
38
- super(caps: caps, url: url, **opts)
38
+ super(caps: caps, url: url, **)
39
39
  @bridge.file_detector = ->((filename, *)) { File.exist?(filename) && filename.to_s }
40
40
  command_list = @bridge.command_list
41
41
  @bridge.extend(WebDriver::Remote::Features)
@@ -31,9 +31,9 @@ module Selenium
31
31
 
32
32
  include LocalDriver
33
33
 
34
- def initialize(options: nil, service: nil, url: nil, **opts)
34
+ def initialize(options: nil, service: nil, url: nil, **)
35
35
  caps, url = initialize_local_driver(options, service, url)
36
- super(caps: caps, url: url, **opts)
36
+ super(caps: caps, url: url, **)
37
37
  end
38
38
 
39
39
  def browser
@@ -25,8 +25,8 @@ module Selenium
25
25
  @callback = callback
26
26
  end
27
27
 
28
- def method_missing(meth, *args) # rubocop:disable Style/MissingRespondToMissing
29
- @callback.call meth, *args
28
+ def method_missing(meth, *) # rubocop:disable Style/MissingRespondToMissing
29
+ @callback.call(meth, *)
30
30
  end
31
31
  end # BlockEventListener
32
32
  end # Support
@@ -112,10 +112,10 @@ module Selenium
112
112
  @driver ||= Driver.new(bridge: self)
113
113
  end
114
114
 
115
- def dispatch(name, *args)
116
- @listener.__send__(:"before_#{name}", *args)
115
+ def dispatch(name, *)
116
+ @listener.__send__(:"before_#{name}", *)
117
117
  returned = yield
118
- @listener.__send__(:"after_#{name}", *args)
118
+ @listener.__send__(:"after_#{name}", *)
119
119
 
120
120
  returned
121
121
  end
@@ -37,8 +37,10 @@ module Selenium
37
37
  @messages = {}
38
38
  end
39
39
 
40
- def add_condition(name, condition = nil, &block)
40
+ def add_condition(name, condition = false, &block)
41
+ condition = false if condition.nil?
41
42
  @guard_conditions << GuardCondition.new(name, condition, &block)
43
+ WebDriver.logger.debug "Running with Guard '#{name}' set to: #{condition}"
42
44
  end
43
45
 
44
46
  def add_message(name, message)
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.31.0'
22
+ VERSION = '4.33.0'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -21,7 +21,6 @@ require 'tmpdir'
21
21
  require 'fileutils'
22
22
  require 'date'
23
23
  require 'json'
24
- require 'set'
25
24
  require 'uri'
26
25
  require 'net/http'
27
26
 
@@ -85,8 +84,8 @@ module Selenium
85
84
  # @see Selenium::WebDriver::Support::AbstractEventListener
86
85
  #
87
86
 
88
- def self.for(*args)
89
- WebDriver::Driver.for(*args)
87
+ def self.for(*)
88
+ WebDriver::Driver.for(*)
90
89
  end
91
90
 
92
91
  #
@@ -95,9 +94,9 @@ module Selenium
95
94
  # @return [Logger]
96
95
  #
97
96
 
98
- def self.logger(**opts)
97
+ def self.logger(**)
99
98
  level = $DEBUG || ENV.key?('DEBUG') ? :debug : :info
100
- @logger ||= WebDriver::Logger.new('Selenium', default_level: level, **opts)
99
+ @logger ||= WebDriver::Logger.new('Selenium', default_level: level, **)
101
100
  end
102
101
  end # WebDriver
103
102
  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.1')
33
+ s.required_ruby_version = Gem::Requirement.new('>= 3.2')
34
34
 
35
35
  s.files = [
36
36
  'CHANGES',
@@ -59,10 +59,10 @@ Gem::Specification.new do |s|
59
59
  s.add_development_dependency 'rack', ['~> 2.0']
60
60
  s.add_development_dependency 'rake', ['~> 13.0']
61
61
  s.add_development_dependency 'rspec', ['~> 3.0']
62
- s.add_development_dependency 'rubocop', ['~> 1.60', '>=1.60.2']
63
- s.add_development_dependency 'rubocop-performance', ['~> 1.15']
64
- s.add_development_dependency 'rubocop-rake', ['~> 0.6.0']
65
- s.add_development_dependency 'rubocop-rspec', ['~> 2.16']
62
+ s.add_development_dependency 'rubocop', ['~> 1.75']
63
+ s.add_development_dependency 'rubocop-performance', ['~> 1.25']
64
+ s.add_development_dependency 'rubocop-rake', ['~> 0.7']
65
+ s.add_development_dependency 'rubocop-rspec', ['~> 3.5']
66
66
  s.add_development_dependency 'webmock', ['~> 3.5']
67
67
  s.add_development_dependency 'webrick', ['~> 1.7']
68
68
  s.add_development_dependency 'yard', ['~> 0.9.11', '>= 0.9.36']
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.31.0
4
+ version: 4.33.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: 2025-04-05 00:00:00.000000000 Z
13
+ date: 2025-05-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: base64
@@ -156,62 +156,56 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.60'
160
- - - ">="
161
- - !ruby/object:Gem::Version
162
- version: 1.60.2
159
+ version: '1.75'
163
160
  type: :development
164
161
  prerelease: false
165
162
  version_requirements: !ruby/object:Gem::Requirement
166
163
  requirements:
167
164
  - - "~>"
168
165
  - !ruby/object:Gem::Version
169
- version: '1.60'
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: 1.60.2
166
+ version: '1.75'
173
167
  - !ruby/object:Gem::Dependency
174
168
  name: rubocop-performance
175
169
  requirement: !ruby/object:Gem::Requirement
176
170
  requirements:
177
171
  - - "~>"
178
172
  - !ruby/object:Gem::Version
179
- version: '1.15'
173
+ version: '1.25'
180
174
  type: :development
181
175
  prerelease: false
182
176
  version_requirements: !ruby/object:Gem::Requirement
183
177
  requirements:
184
178
  - - "~>"
185
179
  - !ruby/object:Gem::Version
186
- version: '1.15'
180
+ version: '1.25'
187
181
  - !ruby/object:Gem::Dependency
188
182
  name: rubocop-rake
189
183
  requirement: !ruby/object:Gem::Requirement
190
184
  requirements:
191
185
  - - "~>"
192
186
  - !ruby/object:Gem::Version
193
- version: 0.6.0
187
+ version: '0.7'
194
188
  type: :development
195
189
  prerelease: false
196
190
  version_requirements: !ruby/object:Gem::Requirement
197
191
  requirements:
198
192
  - - "~>"
199
193
  - !ruby/object:Gem::Version
200
- version: 0.6.0
194
+ version: '0.7'
201
195
  - !ruby/object:Gem::Dependency
202
196
  name: rubocop-rspec
203
197
  requirement: !ruby/object:Gem::Requirement
204
198
  requirements:
205
199
  - - "~>"
206
200
  - !ruby/object:Gem::Version
207
- version: '2.16'
201
+ version: '3.5'
208
202
  type: :development
209
203
  prerelease: false
210
204
  version_requirements: !ruby/object:Gem::Requirement
211
205
  requirements:
212
206
  - - "~>"
213
207
  - !ruby/object:Gem::Version
214
- version: '2.16'
208
+ version: '3.5'
215
209
  - !ruby/object:Gem::Dependency
216
210
  name: webmock
217
211
  requirement: !ruby/object:Gem::Requirement
@@ -383,6 +377,7 @@ files:
383
377
  - lib/selenium/webdriver/common/options.rb
384
378
  - lib/selenium/webdriver/common/platform.rb
385
379
  - lib/selenium/webdriver/common/port_prober.rb
380
+ - lib/selenium/webdriver/common/print_options.rb
386
381
  - lib/selenium/webdriver/common/profile_helper.rb
387
382
  - lib/selenium/webdriver/common/proxy.rb
388
383
  - lib/selenium/webdriver/common/script.rb
@@ -480,14 +475,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
480
475
  requirements:
481
476
  - - ">="
482
477
  - !ruby/object:Gem::Version
483
- version: '3.1'
478
+ version: '3.2'
484
479
  required_rubygems_version: !ruby/object:Gem::Requirement
485
480
  requirements:
486
481
  - - ">"
487
482
  - !ruby/object:Gem::Version
488
483
  version: 1.3.1
489
484
  requirements: []
490
- rubygems_version: 3.3.27
485
+ rubygems_version: 3.4.19
491
486
  signing_key:
492
487
  specification_version: 4
493
488
  summary: Selenium is a browser automation tool for automated testing of webapps and