From 3c943f82d75df7ee4aa5ee0720e429cbb0439434 Mon Sep 17 00:00:00 2001 From: Zuch Huang Date: Wed, 2 Dec 2026 17:46:46 +0800 Subject: [PATCH] docs(cli): show how to attach to a hosted Chromium browser --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 1df52d3..2218831 100644 --- a/README.md +++ b/README.md @@ -389,6 +389,24 @@ playwright-cli install-browser [browser] # install a browser `install-browser` accepts `--with-deps`, `--dry-run`, `--list`, `--force`, `--only-shell` and `--no-shell`; use `playwright-cli install-browser --help` for details. +#### Attach to a hosted Chromium browser over CDP + +If a hosted Chromium browser provides a browser-level WebSocket CDP URL, use that URL in +`--cdp` and give the CLI session a name. For one example of a hosted endpoint, see the +[Cloudbrowser connection guide](https://cloudbrowser.tv/docs/connections). + +```bash +# Set CDP_URL to the browser's WebSocket CDP endpoint before running these commands. +playwright-cli -s=remote attach --cdp="$CDP_URL" +playwright-cli -s=remote tab-list +playwright-cli -s=remote detach +``` + +Use `tab-list` to find the existing tabs. Detaching ends the CLI session. If the hosted +browser is still running and the endpoint is still valid, attaching again lets you +inspect the same tabs. Treat a URL containing credentials as a secret and keep it +out of logs and shared configuration files. + When attaching via the Playwright Extension, the session controls only the tabs selected by the user and the tabs it opens. These tabs form a group named after the session. Use `--session-color` to choose its color, or `--no-tab-group` to leave the tabs ungrouped: