Skip to content

Document attaching to an already issued CDP WebSocket URL #558

Done
microsoft/playwright.dev
#2201

Description

@laotoutou

Documentation gap

The CDP endpoint section shows HTTP discovery on a local debugging port and names hosted browser services. The remote workflow demonstrates a host the reader can access over SSH. A hosted Chrome user may already have a complete authenticated browser-level WebSocket URL, with no host or port they can manage.

Could the CDP section include a small example that accepts the complete wss:// URL and uses detach when done?

playwright-cli attach --cdp="$BROWSER_CDP_URL" -s=hosted
playwright-cli -s=hosted tab-list
playwright-cli -s=hosted detach

BROWSER_CDP_URL comes from the browser provider. It may contain credentials in the path or query. Preserve it exactly and keep it out of repository files and logs. The hosted browser's lifecycle remains with its provider.

Verification

With Playwright CLI 0.1.25, I used a dedicated Cloudbrowser Chrome instance to open a synthetic tab, detach, and reconnect. On the second connection tab-list still showed the original tab. This was tested within one Chrome runtime. The Cloudbrowser connection guide documents the kind of endpoint used for this check.

Following the request to open an issue first on #557. I'm affiliated with the service used for the test and used AI assistance on the write-up. If this fits the documentation, the example can use any compatible hosted Chromium endpoint.

Activity

  1. microsoft-playwright-automation commented on Dec 3, 2026

    @microsoft-playwright-automation
  2. microsoft-playwright-automation commented on Dec 3, 2026

    @microsoft-playwright-automation
    Contributor

    Hi, I'm the Playwright bot. I checked the connection code and prepared a documentation change.

    The CDP section is missing a direct WebSocket example; the connection code already accepts complete ws:// and wss:// URLs. The proposal adds a provider-neutral example with a named session, tab-list, and detach, plus guidance on preserving the URL, protecting credentials, and leaving browser lifecycle management to the provider.

    Draft PR: microsoft/playwright.dev#2201

    Triaged on Linux by the Playwright bot - agent run

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-triage-done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions