feat: add ChromeDriver proxy for WebDriver and BiDi protocol support#164
Merged
feat: add ChromeDriver proxy for WebDriver and BiDi protocol support#164
Conversation
7941a36 to
433f3d1
Compare
Install ChromeDriver matching the Chromium version in both headful and headless images, managed via supervisord on internal port 9225. A new ChromeDriver proxy (exposed on port 9224) intercepts session creation to inject goog:chromeOptions.debuggerAddress so ChromeDriver attaches to the already-running browser, rewrites webSocketUrl in responses to route BiDi traffic back through the proxy, and transparently proxies all other HTTP and WebSocket traffic. Extracts the shared WebSocket bidirectional pump logic from devtoolsproxy into a reusable wsproxy package with a MessageTransform hook, used by both the existing DevTools proxy and the new ChromeDriver proxy. Expands CDP discovery endpoint proxying to include /json/list and makes proxy ports configurable via environment variables. Includes comprehensive unit tests for the ChromeDriver proxy and manual BiDi validation scripts (raw WebSocket, Puppeteer, Selenium). Co-authored-by: Cursor <cursoragent@cursor.com>
Make the chromedriver proxy runtime-configurable and more robust, then add explicit Vibium BiDi e2e coverage using dynamic session endpoints so remote WebDriver workflows are easier and less brittle. Made-with: Cursor
Prevent parallel e2e tests from racing pnpm setup by making playwright dependency installation single-flight, avoiding intermittent ENOENT failures in CI. Made-with: Cursor
6b38b7c to
d428c05
Compare
Serialize BiDi fixture dependency installation to avoid parallel npm races in e2e and recurse through nested Chrome JSON objects so URL rewriting is applied consistently. Made-with: Cursor
Update the Vibium fixture to use the current start/stop API and exercise the ws://.../session path directly, so the e2e suite matches Vibium's documented remote-browser contract while keeping HTTP /session coverage for WebDriver clients. Made-with: Cursor
Drop the newline-only difference in display.go so the PR no longer carries an unrelated formatting change. Made-with: Cursor
Rename the ChromeDriver proxy setting to DevToolsProxyAddr so it reflects the CDP proxy endpoint it targets, and update the config surface to use DEVTOOLS_PROXY_ADDR consistently. Made-with: Cursor
Restore the checked-in server/api file so this PR stops carrying an unrelated binary deletion, and ignore local reference checkouts plus the server/api build artifact path. Made-with: Cursor
hiroTamada
approved these changes
Mar 9, 2026
Contributor
hiroTamada
left a comment
There was a problem hiding this comment.
Clean, well-structured addition of ChromeDriver/BiDi support. The proxy design is minimal — only intercepts session creation and WebSocket URL rewriting. Good extraction of the shared wsproxy package, and solid test coverage across unit, integration, and real e2e with Puppeteer/Selenium/Vibium. Left two minor nits on the wrapper scripts.
Cancel upstream Chrome JSON fetches with the caller context and standardize headful/headless readiness checks so timeout warnings are visible and consistent across wrappers. Made-with: Cursor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Install ChromeDriver matching the Chromium version in both headful and headless images, managed via supervisord on internal port 9225. A new ChromeDriver proxy (exposed on port 9224) intercepts session creation to inject goog:chromeOptions.debuggerAddress so ChromeDriver attaches to the already-running browser (at port 9222), rewrites webSocketUrl in responses to route BiDi traffic back through the proxy, and transparently proxies all other HTTP and WebSocket traffic.
Extracts the shared WebSocket bidirectional pump logic from devtoolsproxy into a reusable wsproxy package with a MessageTransform hook, used by both the existing DevTools proxy and the new ChromeDriver proxy. Expands CDP discovery endpoint proxying to include /json/list and makes proxy ports configurable via environment variables.
Includes comprehensive unit tests for the ChromeDriver proxy and manual BiDi validation scripts (raw WebSocket, Puppeteer, Selenium).
Checklist
Note
Medium Risk
Moderate risk because it adds a new externally exposed ChromeDriver proxy/port and rewrites WebDriver/BiDi session payloads, which can break existing automation clients or routing if misconfigured.
Overview
Adds first-class WebDriver/BiDi support via ChromeDriver. The Chromium headful/headless images now install a matching
chromedriver, run it under supervisord on127.0.0.1:9225, and expose a new public port9224for ChromeDriver access.Introduces a Go ChromeDriver proxy that intercepts
POST /session(and BiDisession.new) to injectgoog:chromeOptions.debuggerAddresspointing at the DevTools proxy, rewrites returnedcapabilities.webSocketUrlto route BiDi back through the proxy, and otherwise reverse-proxies ChromeDriver HTTP/WebSocket traffic.Refactors and hardens proxy plumbing. DevTools proxy ports become configurable (
DEVTOOLS_PROXY_PORT,CHROMEDRIVER_PROXY_PORT, etc.), DevTools JSON discovery proxying is generalized to also cover/json/listwith recursive URL rewriting, and the shared WebSocket pump is extracted into a reusablewsproxypackage.Testing/ops updates. Adds unit tests for JSON rewriting and ChromeDriver proxy behavior, new BiDi e2e tests plus Node-based validation scripts, and updates e2e container helpers to map/wait on the new ChromeDriver port.
Written by Cursor Bugbot for commit 62f0fc5. This will update automatically on new commits. Configure here.