v0.1.5

microsoft/playwright-cliv0.1.5Apr 3, 2026by yury-s

AI Summary

Adds a `--raw` flag for piping command output and refines the `attach` command to support CDP URLs and extension modes.

Key Highlights

  • New global `--raw` flag to strip status/code from output for piping.
  • `attach` command now supports CDP endpoint URLs.
  • `attach --extension` replaces the previous `open --extension` functionality.

Breaking Changes

  • `open --extension` has been replaced by `attach --extension`.

New Features

  • `--raw` flag for command output piping
  • CDP attachment support
  • Simplified extension attachment

Full Release Notes

## 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:

```bash
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.yml
```

Commands 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:

```bash
playwright-cli attach --cdp=http://localhost:9222
```

This 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](https://github.com/microsoft/playwright-mcp) extension has moved from `open` to the dedicated `attach` command. You can also specify the browser:

```bash
playwright-cli attach --extension
playwright-cli attach --extension=chrome
playwright-cli attach --extension=msedge
```

---

### Bug Fixes

- **`tab-new` now navigates to the URL when provided** — previously `playwright-cli tab-new https://example.com` opened a blank tab instead of navigating.
- **`list` command no longer fails when `workspaceDir` is undefined** — fixes a crash when running `playwright-cli list` outside a workspace.