What's New
Pipe CLI Output with --raw
The new global --raw flag strips page status, generated code, and snapshot sections from the output, returning only the result value. Use it to pipe command output into other tools:
playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
playwright-cli --raw eval "JSON.stringify([...document.querySelectorAll('a')].map(a => a.href))" > links.json
TOKEN=$(playwright-cli --raw cookie-get session_id)
playwright-cli --raw localstorage-get theme
playwright-cli --raw snapshot > before.yml
playwright-cli click e5
playwright-cli --raw snapshot > after.yml
diff before.yml after.ymlCommands that don't produce output return nothing.
Attach to Browser via CDP
The attach command now supports connecting to an existing browser via a CDP endpoint URL:
playwright-cli attach --cdp=http://localhost:9222This makes it easy for coding agents to connect to a browser that's already running (e.g. a dev browser or a remote debugging target) without launching a new one.
attach --extension Replaces open --extension
Connecting to a browser via the Playwright MCP Bridge extension has moved from open to the dedicated attach command. You can also specify the browser:
playwright-cli attach --extension
playwright-cli attach --extension=chrome
playwright-cli attach --extension=msedgeBug Fixes
tab-newnow navigates to the URL when provided — previouslyplaywright-cli tab-new https://example.comopened a blank tab instead of navigating.listcommand no longer fails whenworkspaceDiris undefined — fixes a crash when runningplaywright-cli listoutside a workspace.