diff --git a/rb/lib/selenium/webdriver/chrome/options.rb b/rb/lib/selenium/webdriver/chrome/options.rb index 16eeaf87139ca..86ab27da32e44 100755 --- a/rb/lib/selenium/webdriver/chrome/options.rb +++ b/rb/lib/selenium/webdriver/chrome/options.rb @@ -75,7 +75,7 @@ class Options < WebDriver::Options # def initialize(profile: nil, encoded_extensions: nil, **opts) - super(opts) + super(**opts) @profile = profile @options[:encoded_extensions] = encoded_extensions if encoded_extensions diff --git a/rb/lib/selenium/webdriver/common/driver.rb b/rb/lib/selenium/webdriver/common/driver.rb index 5a62b6e8c3153..45ed71c216fc2 100644 --- a/rb/lib/selenium/webdriver/common/driver.rb +++ b/rb/lib/selenium/webdriver/common/driver.rb @@ -43,21 +43,21 @@ class << self def for(browser, opts = {}) case browser when :chrome - Chrome::Driver.new(opts) + Chrome::Driver.new(**opts) when :internet_explorer, :ie - IE::Driver.new(opts) + IE::Driver.new(**opts) when :safari - Safari::Driver.new(opts) + Safari::Driver.new(**opts) when :firefox, :ff - Firefox::Driver.new(opts) + Firefox::Driver.new(**opts) when :edge - Edge::Driver.new(opts) + Edge::Driver.new(**opts) when :edge_chrome - EdgeChrome::Driver.new(opts) + EdgeChrome::Driver.new(**opts) when :edge_html - EdgeHtml::Driver.new(opts) + EdgeHtml::Driver.new(**opts) when :remote - Remote::Driver.new(opts) + Remote::Driver.new(**opts) else raise ArgumentError, "unknown driver: #{browser.inspect}" end @@ -73,7 +73,7 @@ def for(browser, opts = {}) def initialize(bridge: nil, listener: nil, **opts) @service = nil - bridge ||= create_bridge(opts) + bridge ||= create_bridge(**opts) @bridge = listener ? Support::EventFiringBridge.new(bridge, listener) : bridge end @@ -322,7 +322,7 @@ def create_bridge(**opts) bridge_opts = {http_client: opts.delete(:http_client), url: opts.delete(:url)} raise ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty? - bridge = (respond_to?(:bridge_class) ? bridge_class : Remote::Bridge).new(bridge_opts) + bridge = (respond_to?(:bridge_class) ? bridge_class : Remote::Bridge).new(**bridge_opts) bridge.create_session(capabilities) bridge diff --git a/rb/lib/selenium/webdriver/edge_html/options.rb b/rb/lib/selenium/webdriver/edge_html/options.rb index f494028741114..46179d04c8315 100644 --- a/rb/lib/selenium/webdriver/edge_html/options.rb +++ b/rb/lib/selenium/webdriver/edge_html/options.rb @@ -53,7 +53,7 @@ class Options < WebDriver::Options # def initialize(**opts) - super + super(**opts) @options[:extensions]&.each(&method(:validate_extension)) end diff --git a/rb/lib/selenium/webdriver/firefox/options.rb b/rb/lib/selenium/webdriver/firefox/options.rb index c971a5d57a2e6..a3b3a5e195d22 100644 --- a/rb/lib/selenium/webdriver/firefox/options.rb +++ b/rb/lib/selenium/webdriver/firefox/options.rb @@ -58,7 +58,7 @@ class Options < WebDriver::Options # def initialize(log_level: nil, **opts) - super(opts) + super(**opts) @options[:log] ||= {level: log_level} if log_level process_profile(@options[:profile]) if @options.key?(:profile) diff --git a/rb/lib/selenium/webdriver/ie/options.rb b/rb/lib/selenium/webdriver/ie/options.rb index 8ce5f12dbb085..9f504a9029f1f 100644 --- a/rb/lib/selenium/webdriver/ie/options.rb +++ b/rb/lib/selenium/webdriver/ie/options.rb @@ -86,10 +86,10 @@ class Options < WebDriver::Options # @option opts [Boolean] validate_cookie_document_type # - def initialize(args: nil, **opts) - super(opts) + def initialize(**opts) + @args = (opts.delete(:args) || []).to_set + super(**opts) - @args = (args || []).to_set @options[:native_events] = true if @options[:native_events].nil? end diff --git a/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb b/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb index 8606fa08aeec9..e9bf5f4830ff6 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb @@ -34,7 +34,7 @@ def quit_driver end def create_driver!(**opts, &block) - GlobalTestEnv.create_driver!(opts, &block) + GlobalTestEnv.create_driver!(**opts, &block) end def ensure_single_window diff --git a/rb/spec/unit/selenium/webdriver/chrome/driver_spec.rb b/rb/spec/unit/selenium/webdriver/chrome/driver_spec.rb index 2f048389e09ca..e7042c641098e 100644 --- a/rb/spec/unit/selenium/webdriver/chrome/driver_spec.rb +++ b/rb/spec/unit/selenium/webdriver/chrome/driver_spec.rb @@ -116,7 +116,7 @@ def expect_request(body: nil, endpoint: nil) expect_request(body: {capabilities: {firstMatch: ["browserName": "chrome", "goog:chromeOptions": opts]}}) expect { - expect { Driver.new(options: Options.new(opts)) }.to have_deprecated(:browser_options) + expect { Driver.new(options: Options.new(**opts)) }.to have_deprecated(:browser_options) }.not_to raise_exception end @@ -129,7 +129,7 @@ def expect_request(body: nil, endpoint: nil) expect { expect { - Driver.new(options: Options.new(browser_opts), desired_capabilities: caps) + Driver.new(options: Options.new(**browser_opts), desired_capabilities: caps) }.to have_deprecated(%i[browser_options desired_capabilities]) }.not_to raise_exception end diff --git a/rb/spec/unit/selenium/webdriver/edge/driver_spec.rb b/rb/spec/unit/selenium/webdriver/edge/driver_spec.rb index 3284ea7dee5c8..fc740d9071215 100644 --- a/rb/spec/unit/selenium/webdriver/edge/driver_spec.rb +++ b/rb/spec/unit/selenium/webdriver/edge/driver_spec.rb @@ -122,7 +122,7 @@ def expect_request(body: nil, endpoint: nil) "ms:startPage": "http://selenium.dev"]}}) expect { - expect { Driver.new(options: Options.new(opts)) }.to have_deprecated(:browser_options) + expect { Driver.new(options: Options.new(**opts)) }.to have_deprecated(:browser_options) }.not_to raise_exception end @@ -136,7 +136,7 @@ def expect_request(body: nil, endpoint: nil) expect { expect { - Driver.new(options: Options.new(browser_opts), desired_capabilities: caps) + Driver.new(options: Options.new(**browser_opts), desired_capabilities: caps) }.to have_deprecated(%i[browser_options desired_capabilities]) }.not_to raise_exception end @@ -215,7 +215,7 @@ def as_json(*) expect_request(body: {capabilities: {firstMatch: [browserName: "MicrosoftEdge", 'ms:startPage': 'http://selenium.dev']}}) - expect { Driver.new(capabilities: [Options.new(browser_opts)]) }.not_to raise_exception + expect { Driver.new(capabilities: [Options.new(**browser_opts)]) }.not_to raise_exception end it 'with Capabilities instance' do diff --git a/rb/spec/unit/selenium/webdriver/firefox/driver_spec.rb b/rb/spec/unit/selenium/webdriver/firefox/driver_spec.rb index e3cdfa94d75ed..576b74ad1b13c 100644 --- a/rb/spec/unit/selenium/webdriver/firefox/driver_spec.rb +++ b/rb/spec/unit/selenium/webdriver/firefox/driver_spec.rb @@ -116,7 +116,7 @@ def expect_request(body: nil, endpoint: nil) expect_request(body: {capabilities: {firstMatch: ["browserName": "firefox", "moz:firefoxOptions": opts]}}) expect { - expect { Driver.new(options: Options.new(opts)) }.to have_deprecated(:browser_options) + expect { Driver.new(options: Options.new(**opts)) }.to have_deprecated(:browser_options) }.not_to raise_exception end @@ -129,7 +129,7 @@ def expect_request(body: nil, endpoint: nil) expect { expect { - Driver.new(options: Options.new(browser_opts), desired_capabilities: caps) + Driver.new(options: Options.new(**browser_opts), desired_capabilities: caps) }.to have_deprecated(%i[browser_options desired_capabilities]) }.not_to raise_exception end diff --git a/rb/spec/unit/selenium/webdriver/ie/driver_spec.rb b/rb/spec/unit/selenium/webdriver/ie/driver_spec.rb index 325e852bb37c2..be96f4310a3db 100644 --- a/rb/spec/unit/selenium/webdriver/ie/driver_spec.rb +++ b/rb/spec/unit/selenium/webdriver/ie/driver_spec.rb @@ -128,7 +128,7 @@ def expect_request(body: nil, endpoint: nil) "ie.browserCommandLineSwitches": "-f"}]}}) expect { - expect { Driver.new(options: Options.new(opts)) }.to have_deprecated(:browser_options) + expect { Driver.new(options: Options.new(**opts)) }.to have_deprecated(:browser_options) }.not_to raise_exception end @@ -143,7 +143,7 @@ def expect_request(body: nil, endpoint: nil) expect { expect { - Driver.new(options: Options.new(browser_opts), desired_capabilities: caps) + Driver.new(options: Options.new(**browser_opts), desired_capabilities: caps) }.to have_deprecated(%i[browser_options desired_capabilities]) }.not_to raise_exception end @@ -223,7 +223,7 @@ def as_json(*) 'se:ieOptions': {"startPage": 'http://selenium.dev', 'nativeEvents': true}]}}) - expect { Driver.new(capabilities: [Options.new(browser_opts)]) }.not_to raise_exception + expect { Driver.new(capabilities: [Options.new(**browser_opts)]) }.not_to raise_exception end it 'with Capabilities instance' do diff --git a/rb/spec/unit/selenium/webdriver/remote/driver_spec.rb b/rb/spec/unit/selenium/webdriver/remote/driver_spec.rb index 69e6332e2ac56..5a1e20043e640 100644 --- a/rb/spec/unit/selenium/webdriver/remote/driver_spec.rb +++ b/rb/spec/unit/selenium/webdriver/remote/driver_spec.rb @@ -132,7 +132,7 @@ def expect_request(body: nil, endpoint: nil) expect_request(body: {capabilities: {firstMatch: [browserName: 'chrome', "goog:chromeOptions": opts]}}) expect { - expect { Driver.new(options: Chrome::Options.new(opts)) }.to have_deprecated(:browser_options) + expect { Driver.new(options: Chrome::Options.new(**opts)) }.to have_deprecated(:browser_options) }.not_to raise_exception end @@ -142,7 +142,7 @@ def expect_request(body: nil, endpoint: nil) expect { expect { - Driver.new(desired_capabilities: :chrome, options: Chrome::Options.new(opts)) + Driver.new(desired_capabilities: :chrome, options: Chrome::Options.new(**opts)) }.to have_deprecated(%i[browser_options desired_capabilities]) }.not_to raise_exception end diff --git a/rb/spec/unit/selenium/webdriver/safari/driver_spec.rb b/rb/spec/unit/selenium/webdriver/safari/driver_spec.rb index 7e54bb959e7b2..4b166a4317d04 100644 --- a/rb/spec/unit/selenium/webdriver/safari/driver_spec.rb +++ b/rb/spec/unit/selenium/webdriver/safari/driver_spec.rb @@ -126,7 +126,7 @@ def expect_request(body: nil, endpoint: nil) "safari:automaticInspection": true]}}) expect { - expect { Driver.new(options: Options.new(opts)) }.to have_deprecated(:browser_options) + expect { Driver.new(options: Options.new(**opts)) }.to have_deprecated(:browser_options) }.not_to raise_exception end @@ -140,7 +140,7 @@ def expect_request(body: nil, endpoint: nil) expect { expect { - Driver.new(options: Options.new(browser_opts), desired_capabilities: caps) + Driver.new(options: Options.new(**browser_opts), desired_capabilities: caps) }.to have_deprecated(%i[browser_options desired_capabilities]) }.not_to raise_exception end @@ -219,7 +219,7 @@ def as_json(*) expect_request(body: {capabilities: {firstMatch: [browserName: "safari", 'safari:automaticInspection': true]}}) - expect { Driver.new(capabilities: [Options.new(browser_opts)]) }.not_to raise_exception + expect { Driver.new(capabilities: [Options.new(**browser_opts)]) }.not_to raise_exception end it 'with Capabilities instance' do