Skip to content

Decide the Selenium CDP screencast from the session capabilities - #566

Open
vishnuv688 wants to merge 3 commits into
mainfrom
fix/564-cdp-decline
Open

vishnuv688 wants to merge 3 commits into
mainfrom
fix/564-cdp-decline

Conversation

@vishnuv688

Copy link
Copy Markdown
Member

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 threw TypeError: debuggerAddress.match is not a function while looking for one. The adapter caught it and fell back to polling, so nothing was lost, but every such run logged CDP 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_URL set, or se:cdp, or a string debuggerAddress under goog:chromeOptions (or ms:edgeOptions when 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

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Polish (an improvement to an existing feature)
  • Breaking change (existing behavior changes for users)
  • Documentation
  • Internal (build, CI, dependencies, tooling)

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.ts updated, and tables regenerated with pnpm docs:capabilities, if this adds or changes user-facing behaviour

No 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's createCDPConnection endpoint lookup line for line, including its quirk that a goog:chromeOptions without debuggerAddress does not fall through to ms:edgeOptions. Every case it declines is one where selenium-webdriver 4.52 throws, so no session that used to get CDP push now polls.
  • Capabilities come from 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.
  • The root README also claimed the screencast went through selenium-webdriver/bidi; it uses createCDPConnection, now stated correctly.
  • An independent review found nothing blocking; its wording points (Firefox on older selenium-webdriver, the changeset's log line, the SELENIUM_REMOTE_URL route in the README) are fixed.

Testing

  • pnpm build, pnpm typecheck, pnpm test (4073 passed, 1 skipped), pnpm lint, pnpm docs:capabilities --check are green.
  • tests/screencast.test.ts: Safari-, Appium native-, Appium Chrome- (goog:chromeOptions: {}, the shape that threw) and Firefox-shaped sessions poll without calling createCDPConnection (these fail without the change); Chrome, Edge, Grid se:cdp and SELENIUM_REMOTE_URL still try CDP; a rejected CDP call still falls back.

Needs checking by hand

  1. DEVTOOLS_MODE=trace SELENIUM_BROWSER=safari pnpm --filter @wdio/selenium-devtools example:mocha: the log shows no CDP endpoint in the session capabilities; polling and no debuggerAddress.match line.
  2. The same example on Chrome still logs Screencast recording started (CDP mode).

Screenshots / recordings

None.

🤖 Generated with Claude Code

vishnuv688 and others added 3 commits November 10, 2026 17:00
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>
@vishnuv688 vishnuv688 self-assigned this Nov 10, 2026
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devtools Ready Ready Preview Nov 10, 2026 11:44am UTC

Request Review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selenium: decline the CDP screencast without a debugger address instead of throwing

1 participant