Repository navigation
Decide the Selenium CDP screencast from the session capabilities - #566
Open
vishnuv688 wants to merge 3 commits into
Open
vishnuv688 wants to merge 3 commits into
vishnuv688 wants to merge 3 commits into
Conversation
selenium-webdriver's createCDPConnection throws a TypeError (debuggerAddress.match is not a function) when a session advertises no CDP endpoint, so every Safari, Appium and Firefox run spent a call on a connection that could not exist and logged it as a CDP failure before polling. Read the endpoint the way selenium-webdriver resolves it (se:cdp, a Chromium vendor debuggerAddress, or the SELENIUM_REMOTE_URL grid route) from the cached capabilities and go straight to polling, with a plain reason, when there is none. A CDP call that still fails keeps its fallback. Closes #564 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Older selenium-webdriver still connects to Firefox over CDP, Firefox logged a refusal rather than the debuggerAddress TypeError, and SELENIUM_REMOTE_URL is another way a session gets a CDP endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch has not been deployed
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 & why
Closes #564. Part of the #516 follow-ups.
The Selenium screencast called selenium-webdriver's
createCDPConnection('page')for every browser. On Safari and Appium there is no CDP endpoint, and selenium-webdriver threwTypeError: debuggerAddress.match is not a functionwhile looking for one. The adapter caught it and fell back to polling, so nothing was lost, but every such run loggedCDP screencast unavailable (debuggerAddress.match is not a function)and spent a call that could not succeed (seen in #516 on desktop Safari and Android/iOS native, and in 44 cloud runs of the PR #442 dataset).The screencast now reads the session capabilities first, with the same rule selenium-webdriver 4.52 uses to find an endpoint:
SELENIUM_REMOTE_URLset, orse:cdp, or a stringdebuggerAddressundergoog:chromeOptions(orms:edgeOptionswhen that is absent); Firefox is declined. A session with no endpoint goes straight to polling with an info line,no CDP endpoint in the session capabilities; polling. A CDP call that still fails falls back as before.Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)selenium-devtools-py(Selenium Python adapter)backend(server)app(UI)script(page-injected runtime)trace(Trace mode)Capability matrix
packages/conformance/src/features.tsupdated, and tables regenerated withpnpm docs:capabilities, if this adds or changes user-facing behaviourNo capability change: the Selenium filmstrip reason ("Chromium streams over CDP; other browsers poll") still holds. The docs site needs no change.
Notes for reviewers
cdpUnavailableReason(helpers/cdp-endpoint.ts) mirrors selenium-webdriver'screateCDPConnectionendpoint lookup line for line, including its quirk that agoog:chromeOptionswithoutdebuggerAddressdoes not fall through toms:edgeOptions. Every case it declines is one where selenium-webdriver 4.52 throws, so no session that used to get CDP push now polls.driver.getCapabilities(), answered from the session selenium-webdriver already holds (no round trip, and an ignored command, so no action row), under the existing handshake ceiling; a driver without it, or a timeout, keeps the old try-then-fall-back path.selenium-webdriver/bidi; it usescreateCDPConnection, now stated correctly.SELENIUM_REMOTE_URLroute in the README) are fixed.Testing
pnpm build,pnpm typecheck,pnpm test(4073 passed, 1 skipped),pnpm lint,pnpm docs:capabilities --checkare green.tests/screencast.test.ts: Safari-, Appium native-, Appium Chrome- (goog:chromeOptions: {}, the shape that threw) and Firefox-shaped sessions poll without callingcreateCDPConnection(these fail without the change); Chrome, Edge, Gridse:cdpandSELENIUM_REMOTE_URLstill try CDP; a rejected CDP call still falls back.Needs checking by hand
DEVTOOLS_MODE=trace SELENIUM_BROWSER=safari pnpm --filter @wdio/selenium-devtools example:mocha: the log showsno CDP endpoint in the session capabilities; pollingand nodebuggerAddress.matchline.Screencast recording started (CDP mode).Screenshots / recordings
None.
🤖 Generated with Claude Code