From 1b905edd2eefcae7106f559db54b930333b1cf7a Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Fri, 21 Jun 2024 09:42:53 +0900 Subject: [PATCH] Support selenium-webdriver 4.22.0 that enables CDP in Firefox by default This pull request supports selenium-webdriver 4.22.0 that enables CDP in Firefox by default. because Firefox 129 deprecates Chrome DevTools Protocol (CDP). selenium-webdriver 4.22.0 enables CDP explicitly by adding "remote.active-protocols"=>3 . - Steps to reproduce and this commit addresses these failures. ```ruby $ bundle update selenium-webdriver --conservative $ git diff main ../Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock index 4e1c049ac0..e05f4b3b3c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -512,8 +512,9 @@ GEM google-protobuf (~> 3.25) sass-embedded (1.69.6-x86_64-linux-gnu) google-protobuf (~> 3.25) - selenium-webdriver (4.20.1) + selenium-webdriver (4.22.0) base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) $ cd actionpack $ bin/test test/dispatch/system_testing/driver_test.rb test/dispatch/system_testing/driver_test.rb Running 18 tests in a single process (parallelization threshold is 50) Run options: --seed 58668 .....F Failure: DriverTest#test_define_extra_capabilities_using_firefox [test/dispatch/system_testing/driver_test.rb:127]: --- expected +++ actual @@ -1 +1 @@ -{"moz:firefoxOptions"=>{"args"=>["--host=127.0.0.1"], "prefs"=>{"browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"} +{"moz:firefoxOptions"=>{"args"=>["--host=127.0.0.1"], "prefs"=>{"remote.active-protocols"=>3, "browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"} bin/test test/dispatch/system_testing/driver_test.rb:113 .F Failure: DriverTest#test_define_extra_capabilities_using_headless_firefox [test/dispatch/system_testing/driver_test.rb:144]: --- expected +++ actual @@ -1 +1 @@ -{"moz:firefoxOptions"=>{"args"=>["-headless", "--host=127.0.0.1"], "prefs"=>{"browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"} +{"moz:firefoxOptions"=>{"args"=>["-headless", "--host=127.0.0.1"], "prefs"=>{"remote.active-protocols"=>3, "browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"} bin/test test/dispatch/system_testing/driver_test.rb:130 .......... Finished in 0.007717s, 2332.3654 runs/s, 4794.3066 assertions/s. 18 runs, 37 assertions, 2 failures, 0 errors, 0 skips ``` - Planned Deprecation of CDP in Firefox https://groups.google.com/a/mozilla.org/g/dev-platform/c/Z6Qu3ZT1MJ0?pli=1 - Add preference to enable CDP in Firefox by default https://github.com/SeleniumHQ/selenium/pull/14091 - [rb] Add logger gem as a runtime dependency #14082 https://github.com/SeleniumHQ/selenium/pull/14082 --- Gemfile.lock | 3 ++- actionpack/test/dispatch/system_testing/driver_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4e1c049ac08f1..e05f4b3b3c81f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -512,8 +512,9 @@ GEM google-protobuf (~> 3.25) sass-embedded (1.69.6-x86_64-linux-gnu) google-protobuf (~> 3.25) - selenium-webdriver (4.20.1) + selenium-webdriver (4.22.0) base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) diff --git a/actionpack/test/dispatch/system_testing/driver_test.rb b/actionpack/test/dispatch/system_testing/driver_test.rb index 410934a305b27..138c1038649e8 100644 --- a/actionpack/test/dispatch/system_testing/driver_test.rb +++ b/actionpack/test/dispatch/system_testing/driver_test.rb @@ -120,7 +120,7 @@ class DriverTest < ActiveSupport::TestCase expected = { "moz:firefoxOptions" => { "args" => ["--host=127.0.0.1"], - "prefs" => { "browser.startup.homepage" => "http://www.seleniumhq.com/" } + "prefs" => { "remote.active-protocols" => 3, "browser.startup.homepage" => "http://www.seleniumhq.com/" } }, "browserName" => "firefox" } @@ -137,7 +137,7 @@ class DriverTest < ActiveSupport::TestCase expected = { "moz:firefoxOptions" => { "args" => ["-headless", "--host=127.0.0.1"], - "prefs" => { "browser.startup.homepage" => "http://www.seleniumhq.com/" } + "prefs" => { "remote.active-protocols" => 3, "browser.startup.homepage" => "http://www.seleniumhq.com/" } }, "browserName" => "firefox" }