browser: add chromium.connectOverCDP for external browsers#6074
Open
pkiv wants to merge 3 commits into
Open
Conversation
Scripts can now connect to external browser instances at
runtime via import { chromium } from 'k6/browser' and
chromium.connect(wsURL). This bypasses the managed browser
registry entirely - users control the browser lifecycle.
Enables use cases like Browserbase where session URLs are
dynamic and fetched per-iteration from an external API.
No cloud or SM platform changes needed: scripts without
options.browser skip the entire managed browser pipeline.
Shows chromium.connectOverCDP() with an external browser provided via K6_BROWSER_WS_URL. No options.browser needed.
|
|
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.
What?
Scripts can connect to external CDP-compatible browsers at runtime without declaring
options.browser.The naming follows Playwright's
chromium.connectOverCDP().Why?
Users with their own browser infrastructure want to run k6 browser tests against their own browsers. Their flow requires a fresh WebSocket URL per session, obtained at runtime via an API call.
Note
CI failures are not related to this PR.