Releases: microsoft/playwright-cli
v0.1.9
Highlights
-
show --annotate— provide agent with visual and structural feedback while developing or testing. (microsoft/playwright#40262, microsoft/playwright#40238)
-
dropcommand for files and clipboard-like data — drop files or typed data (text/plain,text/html, etc.) onto an element from outside the page. Useful for file-upload widgets and drag-from-desktop scenarios whereuploaddoesn't fit. (microsoft/playwright#40367, microsoft/playwright#40283) -
highlightcommand for visual confirmation — show a persistent highlight overlay on an element (with optional custom CSS via--style), and hide one or all overlays with--hide. Lets coding agents visually confirm what they're about to act on. (microsoft/playwright#40213, microsoft/playwright#40215, microsoft/playwright#40219) -
generate-locatorcommand — produce a stable Playwright locator expression for an element ref. Pair with--rawto feed locators straight into test assertions. (microsoft/playwright#40313) -
--jsonglobal flag — wrap every reply as structured JSON for machine parsing. (microsoft/playwright#40284)> playwright-cli eval --json "document.body.childNodes.length" { "result": "4" }
-
snapshot --boxes— include each element's bounding box as[box=x,y,width,height]in aria snapshots, making it easy to drive coordinate-based tools off of a snapshot. (microsoft/playwright#40389)- paragraph [ref=e35] [box=86,381,700,99]: - text: One API to drive Chromium, Firefox, and WebKit — in your tests, your scripts... - link "TypeScript" [ref=e36] [cursor=pointer] [box=535,417,98,27]: - /url: https://playwright.dev/docs/intro - text: "," - link "Python" [ref=e37] [cursor=pointer] [box=644,417,66,27]: - /url: https://playwright.dev/python/docs/intro - text: "," - link ".NET" [ref=e38] [cursor=pointer] [box=721,417,42,27]: - /url: https://playwright.dev/dotnet/docs/intro - text: ", and" - link "Java" [ref=e39] [cursor=pointer] [box=127,450,38,27]: - /url: https://playwright.dev/java/docs/intro
-
Discover attachable system browsers with
list --all— surfaces Chrome/Edge instances running with remote debugging soattach --cdp=<channel>has something to connect to. (microsoft/playwright#40253, microsoft/playwright#40342) -
detachcommand and channel-named attach sessions — attach sessions now use the channel name (e.g.chrome,msedge) and can be cleanly detached without closing the underlying browser. (microsoft/playwright#40408) -
Skill discoverable from
--help—playwright-cli --helpnow prints the path to the installed agent skill, so coding agents can find it without being told. (microsoft/playwright#40274) -
run-codeaccepts a file —playwright-cli run-code --filename=./script.jsruns a Playwright snippet from disk instead of the command line. (microsoft/playwright-cli#337)
Behavior changes
attachnow requires an explicit target; bareattachis no longer allowed. (microsoft/playwright@f7555ef)- The "Playwright MCP Bridge" extension has been renamed to "Playwright Extension", and the CLI now warns when the extension is missing from the target profile. (microsoft/playwright#40259, microsoft/playwright#40406)
- CLI option names have been tidied up to be friendlier for Claude Code and other agents. (microsoft/playwright#40369)
Fixes
fix(cli): exit daemon when extension connection fails— no more orphaned daemons when the browser extension can't connect. (microsoft/playwright#40328)fix(cli): prefix bare filenames with ./ in printed links— output file links now open reliably in terminals and editors. (microsoft/playwright#40311)fix(cli): show "(no browsers)" when list is empty without --all— clearer empty-state output fromlist. (microsoft/playwright#40277)fix(mcp): disable CDP timeout for extension connection— long-running extension attaches no longer time out. (microsoft/playwright#40265)fix(mcp): support page close via extension in protocol v2— closing tabs through the extension works again. (microsoft/playwright#40249)fix(mcp): throw clear error for tab creation in extension protocol v1— replaces a cryptic failure with a readable message. (microsoft/playwright#40261)fix(mcp): ensure --proxy-server overrides config-file proxy— explicit CLI proxy now wins over the config value. (microsoft/playwright#40212)fix(server): close browsers when PlaywrightServer shuts down— cleaner shutdown, no lingering browser processes. (microsoft/playwright#40294)
Upgrading
npm install -g @playwright/cli@latestv0.1.8
Highlights
- Remote debugging mode against your local Chrome (#358) — you can now drive the Chrome you already have open, with its existing logins, instead of a sandboxed copy.
playwright-cli attach --cdp=chrome(alsomsedge,chrome-canary, etc.) resolves the channel and connects viachrome://inspect/#remote-debugging. Supports Chrome / Chrome Beta / Dev / Canary and Edge / Edge Beta / Dev / Canary on Linux, macOS, and Windows. (microsoft/playwright#40177) - Heavy CPU/memory and orphaned Chrome processes (#360) — no more manually killing leftover Chrome processes after long CLI/agent sessions. (microsoft/playwright#40190)
Fixes
fix(mcp): no tombstones on the server registry level— defaultsbrowserTokento'chrome'when none is specified (no moreundefinedin userDataDir paths); simplifies stale-entry cleanup in the server registry; passesforceto session stop duringdelete-data. (#40179)
Upgrading
npm install -g @playwright/cli@0.1.8v0.1.7
What's Changed
Fixes
- snapshot: resolve element refs correctly so snapshots taken after navigation no longer fail to look up references (microsoft/playwright#40114)
- kill-all: match the current
cliDaemon.jsprocess soplaywright-cli kill-allactually terminates running daemons (microsoft/playwright#40165)
v0.1.6
v0.1.5
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.
v0.1.4
- chore: roll Playwright to 1.60.0-alpha-1775061447000
v0.1.3
- Maintenance release off 1.59 branch point
v0.1.2
What's New
🎬 Richer Video Recording
The video-start / video-chapter / video-stop commands now support action annotations and chapter markers backed by the new page.screencast API:
playwright-cli open https://demo.playwright.dev/todomvc
playwright-cli video-start receipt.webm
playwright-cli video-chapter "Adding Todo Items" --description="We will add several items to the todo list." --duration=2000
playwright-cli fill e8 "Buy groceries"
playwright-cli press Enter
playwright-cli video-stopSee the video recording reference for full examples.
🤖 CLI Debugger
Note
Requires @playwright/test v1.59 or later.
Coding agents can now attach to a running Playwright test for interactive debugging. Run the test with --debug=cli, then attach with playwright-cli:
$ npx playwright test --debug=cli
### Debugging Instructions
- Run "playwright-cli attach tw-87b59e" to attach to this test
$ playwright-cli attach tw-87b59e
### Session `tw-87b59e` created, attached to `tw-87b59e`.
### Paused
- Navigate to "/" at tests/example.spec.ts:4
$ playwright-cli --session tw-87b59e step-over
### Paused
- Expect "toHaveTitle" at tests/example.spec.ts:7This pairs playwright-cli's browser control with Playwright's test runner — perfect for automatically diagnosing and fixing failing tests in agentic workflows.
🌐 Network State & Request Inspection
Offline mode — simulate network connectivity loss for testing offline scenarios:
playwright-cli network-state-set offline
# ... test your app's offline behavior ...
playwright-cli network-state-set onlineRicher network output — filter requests by URL pattern and optionally include headers and request bodies:
# Filter to API requests only
playwright-cli network --filter="/api/.*"
# Include request headers and body for inspection
playwright-cli network --filter="/api/.*" --request-headers --request-bodyv0.1.1
📺 Session monitoring
See what your agents are doing — live.
npm i -g @playwright/cli@latest
playwright-cli showRun this to open a dashboard that tiles all running browser sessions with real-time screencasts.
Click into any session to take full remote control — navigate, click, type — then press Escape to hand it back to the agent. Close sessions or clean up data right from the grid.
NOTE: You might need to restart your sessions using the fresh version of Playwright CLI for monitoring to be available!