Skip to content

[rb] Patch devtools to permit up to 3 versions back#17219

Closed
luke-hill wants to merge 1 commit intotrunkfrom
luke-hill-patch-2
Closed

[rb] Patch devtools to permit up to 3 versions back#17219
luke-hill wants to merge 1 commit intotrunkfrom
luke-hill-patch-2

Conversation

@luke-hill
Copy link
Contributor

Whilst there is an issue with devtools being released to rubygems, this is a short "quick" temporary fix to unblock users who now are on chrome v146 and cannot use selenium w/ devtools

🔗 Related Issues

💥 What does this PR do?

🔧 Implementation Notes

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)
  • Bug fix (backwards compatible)
  • New feature (non-breaking change which adds functionality and tests!)
  • Breaking change (fix or feature that would cause existing functionality to change)

Whilst there is an issue with devtools being released to rubygems, this is a short "quick" temporary fix to unblock users who now are on chrome v146 and cannot use selenium w/ devtools
Copilot AI review requested due to automatic review settings March 13, 2026 11:18
@qodo-code-review
Copy link
Contributor

Review Summary by Qodo

Extend devtools fallback to support 3 versions back

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Extends devtools version fallback to support up to 3 versions back
• Allows users on Chrome v146 to use Selenium with older devtools versions
• Temporary workaround for devtools gem release delays

Grey Divider

File Changes

1. rb/lib/selenium/devtools.rb 🐞 Bug fix +7/-3

Add third version fallback for devtools loading

• Updated comment to reflect 3 versions back instead of 2
• Added nested try-catch block to attempt loading devtools version 3 versions back
• Maintains existing error message for when all fallback versions fail

rb/lib/selenium/devtools.rb


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Mar 13, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Comment restates behavior 📘 Rule violation ✓ Correctness
Description
The updated comment explains what the code does (load up to 3 versions back) but not why this
fallback policy exists. This reduces maintainability because future changes won’t understand the
rationale/constraint behind the chosen number of versions.
Code

rb/lib/selenium/devtools.rb[35]

+      # Try to load up to 3 versions back
Evidence
PR Compliance ID 10 requires comments to explain rationale rather than restating mechanics. The
modified line is a mechanics-only comment describing the exact behavior change without
justification.

AGENTS.md
rb/lib/selenium/devtools.rb[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The comment describes what the code does ("load up to 3 versions back") but does not explain why the fallback window is 3, which makes future maintenance harder.

## Issue Context
This line was modified in the PR, so it should follow the repo’s comment guidance: explain rationale/constraints rather than mechanics.

## Fix Focus Areas
- rb/lib/selenium/devtools.rb[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Missing -3 fallback test 🐞 Bug ⛯ Reliability
Description
The new third fallback path in Selenium::DevTools.load_older_version (@version - 3) is untested, so
CI will not catch regressions that break users who need a 3-versions-back fallback. This can surface
as a runtime WebDriver::Error::WebDriverError even when a compatible older selenium-devtools version
exists.
Code

rb/lib/selenium/devtools.rb[R42-47]

+          begin
+            load_old_version(@version - 3)
+          rescue LoadError
+            raise WebDriver::Error::WebDriverError,
+                  'Could not find a valid devtools version; use a more recent version of selenium-devtools gem'
+          end
Evidence
The PR adds a third fallback attempt (version-3) in load_older_version, but the unit spec only
validates a +1 version mismatch scenario, which exercises only the first fallback (version-1) and
does not reach the new branch.

rb/lib/selenium/devtools.rb[35-47]
rb/spec/unit/selenium/devtools_spec.rb[35-43]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The PR adds a third fallback attempt in `Selenium::DevTools.load_older_version` (`@version - 3`), but the test suite does not exercise this new branch.

### Issue Context
Current unit coverage only tests a `current_version + 1` mismatch, which will succeed on the first fallback attempt (`-1`) and never reaches the new `-3` logic.

### Fix Focus Areas
- rb/lib/selenium/devtools.rb[35-49]
- rb/spec/unit/selenium/devtools_spec.rb[35-43]

### Suggested test approach (RSpec)
- Add a new context (or extend the existing one) that:
 - Sets `described_class.version` to a value requiring 3-step fallback.
 - Stubs `described_class`’s private `load_old_version` so that calls for `version-1` and `version-2` raise `LoadError`, and `version-3` succeeds (and updates `described_class.version`).
 - Calls `described_class.send(:load_older_version)` (private method) and asserts:
   - `load_old_version` was invoked with `version-1`, `version-2`, `version-3` in order.
   - Final `described_class.version == version-3`.

This validates the control flow of the new branch without depending on which devtools versions happen to exist in the runtime gemset.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

3. Non-scalable rescue nesting 🐞 Bug ⛯ Reliability
Description
load_older_version now relies on triple-nested begin/rescue blocks, making the fallback policy
harder to read and more error-prone to extend or modify. This increases maintenance risk around the
DevTools version selection logic.
Code

rb/lib/selenium/devtools.rb[R37-49]

        load_old_version(@version - 1)
      rescue LoadError
        begin
          load_old_version(@version - 2)
        rescue LoadError
-          raise WebDriver::Error::WebDriverError,
-                'Could not find a valid devtools version; use a more recent version of selenium-devtools gem'
+          begin
+            load_old_version(@version - 3)
+          rescue LoadError
+            raise WebDriver::Error::WebDriverError,
+                  'Could not find a valid devtools version; use a more recent version of selenium-devtools gem'
+          end
        end
      end
Evidence
The fallback logic is implemented as nested exception handling; adding another fallback or changing
behavior requires editing multiple nested blocks and can easily introduce subtle control-flow
mistakes.

rb/lib/selenium/devtools.rb[35-49]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`load_older_version` uses nested `begin/rescue LoadError` blocks for each fallback attempt, which is harder to maintain.

### Issue Context
The method behavior is: try `@version-1`, then `@version-2`, then `@version-3`, then raise.

### Fix Focus Areas
- rb/lib/selenium/devtools.rb[35-49]

### Refactor direction
Replace the nested exception blocks with a loop such as:
- Iterate offsets `[1, 2, 3]`
- For each offset, `begin; load_old_version(@version - offset); return; rescue LoadError; end`
- After the loop, raise the existing `WebDriverError`

This keeps identical semantics while making the fallback depth easy to adjust.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Ruby DevTools loader to tolerate a wider mismatch window between the requested Chrome/DevTools version and the available selenium-devtools gem versions, temporarily unblocking users on newer Chrome releases.

Changes:

  • Extend the DevTools fallback logic from “up to 2 versions back” to “up to 3 versions back”.
  • Update the inline comment to reflect the new fallback window.

Comment on lines 39 to +47
begin
load_old_version(@version - 2)
rescue LoadError
raise WebDriver::Error::WebDriverError,
'Could not find a valid devtools version; use a more recent version of selenium-devtools gem'
begin
load_old_version(@version - 3)
rescue LoadError
raise WebDriver::Error::WebDriverError,
'Could not find a valid devtools version; use a more recent version of selenium-devtools gem'
end
Comment on lines +42 to +46
begin
load_old_version(@version - 3)
rescue LoadError
raise WebDriver::Error::WebDriverError,
'Could not find a valid devtools version; use a more recent version of selenium-devtools gem'
@qodo-code-review
Copy link
Contributor

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: Ruby / Local Tests (chrome, macos) / Local Tests (chrome, macos)

Failed stage: Run Bazel [❌]

Failed test name: //rb/spec/integration/selenium/webdriver:devtools-chrome

Failure summary:

The GitHub Action failed because a Bazel test target failed:
//rb/spec/integration/selenium/webdriver:devtools-chrome.
- The failing specs are in
./rb/spec/integration/selenium/webdriver/devtools_spec.rb (e.g. lines 88, 144, 160, 233).
- The
failures are Selenium::WebDriver::Error::SessionNotCreatedError: session not created: Chrome
instance exited, occurring during the after { |example| reset_driver!(example: example) } teardown
(see ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:26 and stack through
rb/spec/.../spec_support/test_environment.rb).
- Logs show Chrome DevTools bindings version
mismatch/fallback (Could not load selenium-devtools v146... Using ... v145), and the underlying
cause appears to be a Chrome/ChromeDriver crash (Selenium::WebDriver::Error::WebDriverError with a
chromedriver stack trace).
- Bazel retried the test (--flaky_test_attempts 2) and it failed in 2/2
runs, so the workflow ended with exit code 3.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

580:  �[32mAnalyzing:�[0m 28 targets (26 packages loaded, 0 targets configured)
581:  �[32mAnalyzing:�[0m 28 targets (26 packages loaded, 0 targets configured)
582:  �[32mAnalyzing:�[0m 28 targets (76 packages loaded, 19 targets configured)
583:  �[32mAnalyzing:�[0m 28 targets (166 packages loaded, 230 targets configured)
584:  �[32mAnalyzing:�[0m 28 targets (171 packages loaded, 2638 targets configured)
585:  �[32mAnalyzing:�[0m 28 targets (184 packages loaded, 2856 targets configured)
586:  �[32mAnalyzing:�[0m 28 targets (184 packages loaded, 2856 targets configured)
587:  �[32mAnalyzing:�[0m 28 targets (189 packages loaded, 8411 targets configured)
588:  �[32mAnalyzing:�[0m 28 targets (189 packages loaded, 8411 targets configured)
589:  �[32mAnalyzing:�[0m 28 targets (208 packages loaded, 10979 targets configured)
590:  �[33mDEBUG: �[0m/Users/runner/.bazel/external/rules_jvm_external+/private/extensions/maven.bzl:295:14: WARNING: The following maven modules appear in multiple sub-modules with potentially different versions. Consider adding one of these to your root module to ensure consistent versions:
591:  org.seleniumhq.selenium:selenium-api
592:  org.seleniumhq.selenium:selenium-remote-driver
593:  �[33mDEBUG: �[0m/Users/runner/.bazel/external/rules_jvm_external+/private/extensions/maven.bzl:295:14: WARNING: The following maven modules appear in multiple sub-modules with potentially different versions. Consider adding one of these to your root module to ensure consistent versions:
594:  com.google.code.findbugs:jsr305
595:  com.google.errorprone:error_prone_annotations
596:  com.google.guava:guava (versions: 30.1.1-jre, 31.0.1-android)
...

908:  �[32m[1,603 / 1,615]�[0m [Prepa] Checking 1 JS files in @@//javascript/webdriver/atoms:attribute-only ... (2 actions, 0 running)
909:  �[32m[1,609 / 1,615]�[0m Compiling 53 JavaScript files to javascript/webdriver/atoms/get-attribute.js; 1s worker ... (3 actions running)
910:  �[32m[1,610 / 1,615]�[0m Compiling 71 JavaScript files to javascript/atoms/fragments/is-displayed.js; 7s worker ... (3 actions, 2 running)
911:  �[32m[1,615 / 1,636]�[0m [Prepa] Testing //rb/spec/integration/selenium/webdriver:fedcm-chrome
912:  �[32m[1,615 / 1,638]�[0m Testing //rb/spec/integration/selenium/webdriver:target_locator-chrome; 0s local ... (3 actions, 1 running)
913:  �[32m[1,615 / 1,638]�[0m Testing //rb/spec/integration/selenium/webdriver:target_locator-chrome; 10s local ... (3 actions, 1 running)
914:  �[32m[1,615 / 1,638]�[0m Testing //rb/spec/integration/selenium/webdriver:target_locator-chrome; 14s local ... (3 actions, 2 running)
915:  �[32m[1,616 / 1,638]�[0m 1 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:fedcm-chrome; 15s ... (3 actions, 1 running)
916:  �[32m[1,616 / 1,638]�[0m 1 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:navigation-chrome; 2s local ... (3 actions, 2 running)
917:  �[32m[1,617 / 1,638]�[0m 2 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:driver-chrome; 4s ... (3 actions, 1 running)
918:  �[32m[1,617 / 1,638]�[0m 2 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:driver-chrome; 14s ... (3 actions, 1 running)
919:  �[32m[1,617 / 1,638]�[0m 2 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:fedcm-chrome; 15s local ... (3 actions, 2 running)
920:  �[32m[1,618 / 1,638]�[0m 3 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver/chrome:profile-chrome; 17s ... (3 actions, 1 running)
921:  �[32m[1,618 / 1,638]�[0m 3 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:driver-chrome; 9s local ... (3 actions, 2 running)
922:  �[32m[1,620 / 1,638]�[0m 5 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:manager-chrome ... (3 actions, 1 running)
923:  �[32m[1,620 / 1,638]�[0m 5 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:error-chrome; 2s local ... (3 actions, 2 running)
924:  �[32m[1,621 / 1,638]�[0m 6 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:virtual_authenticator-chrome ... (3 actions, 1 running)
...

953:  �[32m[1,636 / 1,638]�[0m 21 / 28 tests;�[0m [Sched] Testing //rb/spec/integration/selenium/webdriver:select-chrome; 17s ... (2 actions, 1 running)
954:  �[32m[1,636 / 1,638]�[0m 21 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:timeout-chrome; 9s local ... (2 actions running)
955:  �[32m[1,637 / 1,638]�[0m 22 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:select-chrome; 1s local
956:  �[32m[1,637 / 1,638]�[0m 22 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:select-chrome; 8s local
957:  �[32m[1,638 / 1,639]�[0m 23 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:browser-chrome; 1s local
958:  �[32m[1,639 / 1,640]�[0m 24 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:browsing_context-chrome; 0s local
959:  �[32m[1,640 / 1,641]�[0m 25 / 28 tests;�[0m [Prepa] Testing //rb/spec/integration/selenium/webdriver/bidi:script-chrome
960:  �[32m[1,640 / 1,641]�[0m 25 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:script-chrome; 0s local
961:  �[32m[1,641 / 1,642]�[0m 26 / 28 tests;�[0m [Prepa] Testing //rb/spec/integration/selenium/webdriver:devtools-chrome
962:  �[32m[1,641 / 1,642]�[0m 26 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 0s local
963:  �[32m[1,641 / 1,642]�[0m 26 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 61s local
964:  �[31m�[1mFAIL: �[0m//rb/spec/integration/selenium/webdriver:devtools-chrome (see /Users/runner/.bazel/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/devtools-chrome/test_attempts/attempt_1.log)
965:  �[32m[1,641 / 1,642]�[0m 26 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 62s local
966:  �[32m[1,641 / 1,642]�[0m 26 / 28 tests;�[0m Testing //rb/spec/integration/selenium/webdriver:devtools-chrome; 108s local
967:  �[31m�[1mFAIL: �[0m//rb/spec/integration/selenium/webdriver:devtools-chrome (see /Users/runner/.bazel/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/devtools-chrome/test.log)
968:  �[31m�[1mFAILED: �[0m//rb/spec/integration/selenium/webdriver:devtools-chrome (Summary)
969:  /Users/runner/.bazel/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/devtools-chrome/test.log
...

972:  ==================== Test output for //rb/spec/integration/selenium/webdriver:devtools-chrome:
973:  Running Ruby specs:
974:  browser: chrome
975:  driver: chrome
976:  version: stable
977:  platform: macosx
978:  ci: github
979:  rbe: false
980:  ruby: ruby 3.2.9 (2025-07-24 revision 8f611e0c46) [arm64-darwin23]
981:  Selenium::WebDriver::DevTools
982:  2026-03-13 11:34:59 WARN Selenium [:devtools] Could not load selenium-devtools v146. Trying older versions. 
983:  2026-03-13 11:35:00 WARN Selenium [:devtools] Using selenium-devtools version v145, some features may not work as expected. 
984:  sends commands
985:  maps methods to classes
986:  supports events
987:  logs errors in events
988:  notifies about log messages
989:  notifies about document log messages
990:  notifies about exceptions
991:  notifies about DOM mutations
992:  #target
993:  target type defaults to page
994:  target type is service_worker
995:  throws an error for unknown target type
996:  #register
997:  on any request
998:  based on URL (FAILED - 1)
999:  #intercept
1000:  continues requests
1001:  changes requests
1002:  continues responses
1003:  changes responses
1004:  #pin_script
1005:  allows to pin script
1006:  ensures pinned script is available on new pages
1007:  allows to unpin script
1008:  ensures unpinned scripts are not available on new pages
1009:  handles arguments in pinned script
1010:  supports async pinned scripts
1011:  Failures:
1012:  1) Selenium::WebDriver::DevTools#register based on URL
1013:  Failure/Error: after { |example| reset_driver!(example: example) }
1014:  Selenium::WebDriver::Error::SessionNotCreatedError:
1015:  session not created: Chrome instance exited. Examine ChromeDriver verbose log to determine the cause.
1016:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
1017:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
1018:  # ./rb/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
...

1027:  # ./rb/lib/selenium/webdriver/common/driver.rb:324:in `create_bridge'
1028:  # ./rb/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
1029:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:35:in `block in initialize'
1030:  # ./rb/lib/selenium/webdriver/common/local_driver.rb:31:in `initialize_local_driver'
1031:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:34:in `initialize'
1032:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `new'
1033:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `for'
1034:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:270:in `chrome_driver'
1035:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:195:in `create_driver!'
1036:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:72:in `driver_instance'
1037:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:81:in `reset_driver!'
1038:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb:29:in `reset_driver!'
1039:  # ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:26:in `block (2 levels) in <module:WebDriver>'
1040:  # ------------------
1041:  # --- Caused by: ---
1042:  # Selenium::WebDriver::Error::WebDriverError:
1043:  #   0   chromedriver                        0x00000001033db4e4 cxxbridge1$str$ptr + 3160724
...

1047:  4   chromedriver                        0x0000000102ed9cb4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 280744
1048:  5   chromedriver                        0x0000000102f1da00 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 558580
1049:  6   chromedriver                        0x0000000102f1d430 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 557092
1050:  7   chromedriver                        0x0000000102ee51b4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 327080
1051:  8   chromedriver                        0x0000000103399e80 cxxbridge1$str$ptr + 2892848
1052:  9   chromedriver                        0x000000010339d570 cxxbridge1$str$ptr + 2906912
1053:  10  chromedriver                        0x000000010337f5dc cxxbridge1$str$ptr + 2784140
1054:  11  chromedriver                        0x000000010339ddf4 cxxbridge1$str$ptr + 2909092
1055:  12  chromedriver                        0x000000010337006c cxxbridge1$str$ptr + 2721308
1056:  13  chromedriver                        0x00000001033c29a8 cxxbridge1$str$ptr + 3059544
1057:  14  chromedriver                        0x00000001033c2b24 cxxbridge1$str$ptr + 3059924
1058:  15  chromedriver                        0x00000001033d31d0 cxxbridge1$str$ptr + 3127168
1059:  16  libsystem_pthread.dylib             0x00000001885d7bc8 _pthread_start + 136
1060:  17  libsystem_pthread.dylib             0x00000001885d2b80 thread_start + 8
1061:  Finished in 59.27 seconds (files took 1.12 seconds to load)
1062:  23 examples, 1 failure
1063:  Failed examples:
1064:  rspec ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:88 # Selenium::WebDriver::DevTools#register based on URL
...

1066:  ==================== Test output for //rb/spec/integration/selenium/webdriver:devtools-chrome:
1067:  Running Ruby specs:
1068:  browser: chrome
1069:  driver: chrome
1070:  version: stable
1071:  platform: macosx
1072:  ci: github
1073:  rbe: false
1074:  ruby: ruby 3.2.9 (2025-07-24 revision 8f611e0c46) [arm64-darwin23]
1075:  Selenium::WebDriver::DevTools
1076:  2026-03-13 11:36:00 WARN Selenium [:devtools] Could not load selenium-devtools v146. Trying older versions. 
1077:  2026-03-13 11:36:00 WARN Selenium [:devtools] Using selenium-devtools version v145, some features may not work as expected. 
1078:  sends commands
1079:  maps methods to classes
1080:  supports events
1081:  logs errors in events
1082:  notifies about log messages
1083:  notifies about document log messages
1084:  notifies about exceptions
1085:  notifies about DOM mutations (FAILED - 1)
1086:  #target
1087:  target type defaults to page
1088:  target type is service_worker
1089:  throws an error for unknown target type
1090:  #register
1091:  on any request
1092:  based on URL
1093:  #intercept
1094:  continues requests (FAILED - 2)
1095:  changes requests
1096:  continues responses
1097:  changes responses
1098:  #pin_script
1099:  allows to pin script
1100:  ensures pinned script is available on new pages
1101:  allows to unpin script
1102:  ensures unpinned scripts are not available on new pages (FAILED - 3)
1103:  handles arguments in pinned script
1104:  supports async pinned scripts
1105:  Failures:
1106:  1) Selenium::WebDriver::DevTools notifies about DOM mutations
1107:  Failure/Error: after { |example| reset_driver!(example: example) }
1108:  Selenium::WebDriver::Error::SessionNotCreatedError:
1109:  session not created: Chrome instance exited. Examine ChromeDriver verbose log to determine the cause.
1110:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
1111:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
1112:  # ./rb/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
...

1121:  # ./rb/lib/selenium/webdriver/common/driver.rb:324:in `create_bridge'
1122:  # ./rb/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
1123:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:35:in `block in initialize'
1124:  # ./rb/lib/selenium/webdriver/common/local_driver.rb:31:in `initialize_local_driver'
1125:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:34:in `initialize'
1126:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `new'
1127:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `for'
1128:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:270:in `chrome_driver'
1129:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:195:in `create_driver!'
1130:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:72:in `driver_instance'
1131:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:81:in `reset_driver!'
1132:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb:29:in `reset_driver!'
1133:  # ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:26:in `block (2 levels) in <module:WebDriver>'
1134:  # ------------------
1135:  # --- Caused by: ---
1136:  # Selenium::WebDriver::Error::WebDriverError:
1137:  #   0   chromedriver                        0x000000010290b4e4 cxxbridge1$str$ptr + 3160724
...

1141:  4   chromedriver                        0x0000000102409cb4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 280744
1142:  5   chromedriver                        0x000000010244da00 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 558580
1143:  6   chromedriver                        0x000000010244d430 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 557092
1144:  7   chromedriver                        0x00000001024151b4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 327080
1145:  8   chromedriver                        0x00000001028c9e80 cxxbridge1$str$ptr + 2892848
1146:  9   chromedriver                        0x00000001028cd570 cxxbridge1$str$ptr + 2906912
1147:  10  chromedriver                        0x00000001028af5dc cxxbridge1$str$ptr + 2784140
1148:  11  chromedriver                        0x00000001028cddf4 cxxbridge1$str$ptr + 2909092
1149:  12  chromedriver                        0x00000001028a006c cxxbridge1$str$ptr + 2721308
1150:  13  chromedriver                        0x00000001028f29a8 cxxbridge1$str$ptr + 3059544
1151:  14  chromedriver                        0x00000001028f2b24 cxxbridge1$str$ptr + 3059924
1152:  15  chromedriver                        0x00000001029031d0 cxxbridge1$str$ptr + 3127168
1153:  16  libsystem_pthread.dylib             0x00000001885d7bc8 _pthread_start + 136
1154:  17  libsystem_pthread.dylib             0x00000001885d2b80 thread_start + 8
1155:  2) Selenium::WebDriver::DevTools#intercept continues requests
1156:  Failure/Error: after { |example| reset_driver!(example: example) }
1157:  Selenium::WebDriver::Error::SessionNotCreatedError:
1158:  session not created: Chrome instance exited. Examine ChromeDriver verbose log to determine the cause.
1159:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
1160:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
1161:  # ./rb/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
...

1170:  # ./rb/lib/selenium/webdriver/common/driver.rb:324:in `create_bridge'
1171:  # ./rb/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
1172:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:35:in `block in initialize'
1173:  # ./rb/lib/selenium/webdriver/common/local_driver.rb:31:in `initialize_local_driver'
1174:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:34:in `initialize'
1175:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `new'
1176:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `for'
1177:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:270:in `chrome_driver'
1178:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:195:in `create_driver!'
1179:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:72:in `driver_instance'
1180:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:81:in `reset_driver!'
1181:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb:29:in `reset_driver!'
1182:  # ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:26:in `block (2 levels) in <module:WebDriver>'
1183:  # ------------------
1184:  # --- Caused by: ---
1185:  # Selenium::WebDriver::Error::WebDriverError:
1186:  #   0   chromedriver                        0x0000000104d574e4 cxxbridge1$str$ptr + 3160724
...

1190:  4   chromedriver                        0x0000000104855cb4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 280744
1191:  5   chromedriver                        0x0000000104899a00 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 558580
1192:  6   chromedriver                        0x0000000104899430 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 557092
1193:  7   chromedriver                        0x00000001048611b4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 327080
1194:  8   chromedriver                        0x0000000104d15e80 cxxbridge1$str$ptr + 2892848
1195:  9   chromedriver                        0x0000000104d19570 cxxbridge1$str$ptr + 2906912
1196:  10  chromedriver                        0x0000000104cfb5dc cxxbridge1$str$ptr + 2784140
1197:  11  chromedriver                        0x0000000104d19df4 cxxbridge1$str$ptr + 2909092
1198:  12  chromedriver                        0x0000000104cec06c cxxbridge1$str$ptr + 2721308
1199:  13  chromedriver                        0x0000000104d3e9a8 cxxbridge1$str$ptr + 3059544
1200:  14  chromedriver                        0x0000000104d3eb24 cxxbridge1$str$ptr + 3059924
1201:  15  chromedriver                        0x0000000104d4f1d0 cxxbridge1$str$ptr + 3127168
1202:  16  libsystem_pthread.dylib             0x00000001885d7bc8 _pthread_start + 136
1203:  17  libsystem_pthread.dylib             0x00000001885d2b80 thread_start + 8
1204:  3) Selenium::WebDriver::DevTools#pin_script ensures unpinned scripts are not available on new pages
1205:  Failure/Error: after { |example| reset_driver!(example: example) }
1206:  Selenium::WebDriver::Error::SessionNotCreatedError:
1207:  session not created: Chrome instance exited. Examine ChromeDriver verbose log to determine the cause.
1208:  # ./rb/lib/selenium/webdriver/remote/response.rb:63:in `add_cause'
1209:  # ./rb/lib/selenium/webdriver/remote/response.rb:41:in `error'
1210:  # ./rb/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
...

1219:  # ./rb/lib/selenium/webdriver/common/driver.rb:324:in `create_bridge'
1220:  # ./rb/lib/selenium/webdriver/common/driver.rb:73:in `initialize'
1221:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:35:in `block in initialize'
1222:  # ./rb/lib/selenium/webdriver/common/local_driver.rb:31:in `initialize_local_driver'
1223:  # ./rb/lib/selenium/webdriver/chrome/driver.rb:34:in `initialize'
1224:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `new'
1225:  # ./rb/lib/selenium/webdriver/common/driver.rb:47:in `for'
1226:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:270:in `chrome_driver'
1227:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:195:in `create_driver!'
1228:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:72:in `driver_instance'
1229:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb:81:in `reset_driver!'
1230:  # /Users/runner/work/selenium/selenium/rb/spec/integration/selenium/webdriver/spec_support/helpers.rb:29:in `reset_driver!'
1231:  # ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:26:in `block (2 levels) in <module:WebDriver>'
1232:  # ------------------
1233:  # --- Caused by: ---
1234:  # Selenium::WebDriver::Error::WebDriverError:
1235:  #   0   chromedriver                        0x0000000104d574e4 cxxbridge1$str$ptr + 3160724
...

1239:  4   chromedriver                        0x0000000104855cb4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 280744
1240:  5   chromedriver                        0x0000000104899a00 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 558580
1241:  6   chromedriver                        0x0000000104899430 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 557092
1242:  7   chromedriver                        0x00000001048611b4 _RNvCskE0kXQ3GIWk_7___rustc35___rust_no_alloc_shim_is_unstable_v2 + 327080
1243:  8   chromedriver                        0x0000000104d15e80 cxxbridge1$str$ptr + 2892848
1244:  9   chromedriver                        0x0000000104d19570 cxxbridge1$str$ptr + 2906912
1245:  10  chromedriver                        0x0000000104cfb5dc cxxbridge1$str$ptr + 2784140
1246:  11  chromedriver                        0x0000000104d19df4 cxxbridge1$str$ptr + 2909092
1247:  12  chromedriver                        0x0000000104cec06c cxxbridge1$str$ptr + 2721308
1248:  13  chromedriver                        0x0000000104d3e9a8 cxxbridge1$str$ptr + 3059544
1249:  14  chromedriver                        0x0000000104d3eb24 cxxbridge1$str$ptr + 3059924
1250:  15  chromedriver                        0x0000000104d4f1d0 cxxbridge1$str$ptr + 3127168
1251:  16  libsystem_pthread.dylib             0x00000001885d7bc8 _pthread_start + 136
1252:  17  libsystem_pthread.dylib             0x00000001885d2b80 thread_start + 8
1253:  Finished in 45.39 seconds (files took 0.30488 seconds to load)
1254:  23 examples, 3 failures
1255:  Failed examples:
1256:  rspec ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:144 # Selenium::WebDriver::DevTools notifies about DOM mutations
1257:  rspec ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:160 # Selenium::WebDriver::DevTools#intercept continues requests
1258:  rspec ./rb/spec/integration/selenium/webdriver/devtools_spec.rb:233 # Selenium::WebDriver::DevTools#pin_script ensures unpinned scripts are not available on new pages
1259:  ================================================================================
1260:  �[32m[1,642 / 1,643]�[0m 27 / 28 tests, �[31m�[1m1 failed�[0m;�[0m Testing //rb/spec/integration/selenium/webdriver/bidi:network-chrome; 0s local
1261:  �[32mINFO: �[0mFound 28 test targets...
1262:  �[32mINFO: �[0mElapsed time: 574.486s, Critical Path: 183.18s
1263:  �[32mINFO: �[0m1643 processes: 783 internal, 714 darwin-sandbox, 58 local, 88 worker.
1264:  �[32mINFO: �[0mBuild completed, 1 test FAILED, 1643 total actions
1265:  //rb/spec/integration/selenium/webdriver:action_builder-chrome           �[0m�[32mPASSED�[0m in 16.4s
1266:  //rb/spec/integration/selenium/webdriver:bidi-chrome                     �[0m�[32mPASSED�[0m in 1.0s
1267:  //rb/spec/integration/selenium/webdriver:driver-chrome                   �[0m�[32mPASSED�[0m in 9.4s
1268:  //rb/spec/integration/selenium/webdriver:element-chrome                  �[0m�[32mPASSED�[0m in 26.3s
1269:  //rb/spec/integration/selenium/webdriver:error-chrome                    �[0m�[32mPASSED�[0m in 2.1s
1270:  //rb/spec/integration/selenium/webdriver:fedcm-chrome                    �[0m�[32mPASSED�[0m in 15.7s
...

1277:  //rb/spec/integration/selenium/webdriver:takes_screenshot-chrome         �[0m�[32mPASSED�[0m in 5.8s
1278:  //rb/spec/integration/selenium/webdriver:target_locator-chrome           �[0m�[32mPASSED�[0m in 14.1s
1279:  //rb/spec/integration/selenium/webdriver:timeout-chrome                  �[0m�[32mPASSED�[0m in 9.8s
1280:  //rb/spec/integration/selenium/webdriver:virtual_authenticator-chrome    �[0m�[32mPASSED�[0m in 3.0s
1281:  //rb/spec/integration/selenium/webdriver:window-chrome                   �[0m�[32mPASSED�[0m in 5.3s
1282:  //rb/spec/integration/selenium/webdriver/bidi:browser-chrome             �[0m�[32mPASSED�[0m in 1.4s
1283:  //rb/spec/integration/selenium/webdriver/bidi:browsing_context-chrome    �[0m�[32mPASSED�[0m in 1.0s
1284:  //rb/spec/integration/selenium/webdriver/bidi:network-chrome             �[0m�[32mPASSED�[0m in 0.9s
1285:  //rb/spec/integration/selenium/webdriver/bidi:script-chrome              �[0m�[32mPASSED�[0m in 1.3s
1286:  //rb/spec/integration/selenium/webdriver/chrome:driver-chrome            �[0m�[32mPASSED�[0m in 33.8s
1287:  //rb/spec/integration/selenium/webdriver/chrome:options-chrome           �[0m�[32mPASSED�[0m in 8.1s
1288:  //rb/spec/integration/selenium/webdriver/chrome:profile-chrome           �[0m�[32mPASSED�[0m in 0.8s
1289:  //rb/spec/integration/selenium/webdriver/chrome:service-chrome           �[0m�[32mPASSED�[0m in 2.1s
1290:  //rb/spec/integration/selenium/webdriver/remote:driver-chrome            �[0m�[32mPASSED�[0m in 0.9s
1291:  //rb/spec/integration/selenium/webdriver/remote:element-chrome           �[0m�[32mPASSED�[0m in 3.8s
1292:  //rb/spec/integration/selenium/webdriver:devtools-chrome                 �[0m�[31m�[1mFAILED�[0m in 2 out of 2 in 61.2s
1293:  Stats over 2 runs: max = 61.2s, min = 46.6s, avg = 53.9s, dev = 7.3s
1294:  /Users/runner/.bazel/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/devtools-chrome/test.log
1295:  /Users/runner/.bazel/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/devtools-chrome/test_attempts/attempt_1.log
1296:  Executed 28 out of 28 tests: 27 tests pass and �[0m�[31m�[1m1 fails locally�[0m.
1297:  There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
1298:  �[0m
1299:  ##[error]Process completed with exit code 3.
1300:  ##[group]Run ./scripts/github-actions/rerun-failures.sh 'bazel test --keep_going --build_tests_only --flaky_test_attempts 2 --local_test_jobs 1 --test_size_filters large --test_tag_filters chrome //rb/spec/...
...

1333:  bazel-bin/rb/lib/selenium/devtools/v143.rb
1334:  bazel-bin/rb/lib/selenium/devtools/v143
1335:  bazel-bin/rb/lib/selenium/devtools/v144.rb
1336:  bazel-bin/rb/lib/selenium/devtools/v144
1337:  bazel-bin/rb/lib/selenium/devtools/v145.rb
1338:  bazel-bin/rb/lib/selenium/devtools/v145
1339:  bazel-bin/rb/lib/selenium/webdriver/atoms/findElements.js
1340:  bazel-bin/rb/lib/selenium/webdriver/atoms/getAttribute.js
1341:  bazel-bin/rb/lib/selenium/webdriver/atoms/isDisplayed.js
1342:  bazel-bin/rb/bin/linux/selenium-manager
1343:  bazel-bin/rb/bin/macos/selenium-manager
1344:  bazel-bin/rb/bin/windows/selenium-manager.exe
1345:  bazel-bin/rb/lib/selenium/webdriver/atoms/mutationListener.js
1346:  �[32mINFO: �[0mElapsed time: 50.032s, Critical Path: 47.63s
1347:  �[32mINFO: �[0m2 processes: 2 local.
1348:  �[32mINFO: �[0mBuild completed, 1 test FAILED, 2 total actions
1349:  //rb/spec/integration/selenium/webdriver:devtools-chrome                 �[0m�[31m�[1mFAILED�[0m in 46.7s
1350:  /Users/runner/.bazel/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/rb/spec/integration/selenium/webdriver/devtools-chrome/test.log
1351:  Executed 1 out of 1 test: �[0m�[31m�[1m1 fails locally�[0m.
1352:  �[0m
1353:  ##[error]Process completed with exit code 3.
1354:  ##[group]Run ./scripts/github-actions/collect-test-logs.sh
...

1409:  With the provided path, there will be 3 files uploaded
1410:  Artifact name is valid!
1411:  Root directory input is valid!
1412:  Beginning upload of artifact content to blob storage
1413:  Uploaded bytes 134316
1414:  Finished uploading artifact content to blob storage!
1415:  SHA256 digest of uploaded artifact zip is 648ad885cf60aeaae2f66e41ee27b86c935c84e7efaa40967a0a331d2f932877
1416:  Finalizing artifact upload
1417:  Artifact test-logs-macos-Local Tests (chrome, macos)-chrome.zip successfully finalized. Artifact ID 5909516449
1418:  Artifact test-logs-macos-Local Tests (chrome, macos)-chrome has been successfully uploaded! Final size is 134316 bytes. Artifact ID is 5909516449
1419:  Artifact download URL: https://github.com/SeleniumHQ/selenium/actions/runs/23048467451/artifacts/5909516449
1420:  ##[group]Run avail=$(df -k "$GITHUB_WORKSPACE" | awk 'NR==2 {printf "%.0f", $4/1024/1024}')
1421:  �[36;1mavail=$(df -k "$GITHUB_WORKSPACE" | awk 'NR==2 {printf "%.0f", $4/1024/1024}')�[0m
1422:  �[36;1mecho "Remaining disk space: ${avail}GB"�[0m
1423:  �[36;1mif [ "$avail" -lt 5 ]; then�[0m
1424:  �[36;1m  echo "::error::Low disk space: ${avail}GB remaining"�[0m
1425:  �[36;1m  exit 1�[0m

@cgoldberg cgoldberg changed the title Patch devtools to permit up to 3 versions back [rb] Patch devtools to permit up to 3 versions back Mar 13, 2026
@diemol
Copy link
Member

diemol commented Mar 14, 2026

I just pushed devtools 144 and 145. This is not needed.

@diemol diemol closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-rb Ruby Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants