| name | playwright-cli-connect |
| description | How to connect playwright-cli to the workspace-browser container via CDP (Chrome DevTools Protocol). Use this skill whenever you need to establish a browser connection before running Playwright CLI browser commands, including when the user mentions CDP, workspace-browser, browser automation setup, cdp-proxy, connecting to a remote Chromium instance, or when a browser command fails because no connection exists. |
Connecting playwright-cli to workspace-browser
This skill covers establishing a CDP connection between playwright-cli and the Chromium browser in workspace-browser.
How to Connect
The browser container name varies by environment. Resolve it from WORKSPACE_ID instead of hardcoding it.
playwright-cli attach --cdp="http://workspace-browser-${WORKSPACE_ID}:9223"
If BROWSER_CDP_URL is injected, use it directly:
playwright-cli attach --cdp="$BROWSER_CDP_URL"
Verify Reachability
Before connecting, you can confirm the CDP endpoint is reachable:
curl -s "http://workspace-browser-${WORKSPACE_ID}:9223/json/version"
Environment Variables
WORKSPACE_ID: Required. Determines the browser container name.
BROWSER_CDP_URL: Optional. Full CDP URL injected by workspace-manager.
Troubleshooting
- Check
WORKSPACE_ID.
- Confirm
workspace-browser is running and healthy.
- Confirm port
9223 is reachable from workspace-runtime.
- Retry the
attach --cdp command with BROWSER_CDP_URL if it is available.