Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ playwright-cli snapshot # capture page snapshot to obtain elemen
playwright-cli snapshot --filename=f # save snapshot to specific file
playwright-cli snapshot <ref> # snapshot a specific element
playwright-cli snapshot --depth=N # limit snapshot depth for efficiency
playwright-cli find <text> # search the snapshot for text, returns matching nodes
playwright-cli find --regex <pattern> # search the snapshot with a regexp
playwright-cli eval <func> [ref] # evaluate javascript expression on page or element
playwright-cli dialog-accept [prompt] # accept a dialog
playwright-cli dialog-dismiss # dismiss a dialog
Expand Down Expand Up @@ -264,6 +266,8 @@ playwright-cli highlight --hide # hide all page highlights

```bash
playwright-cli open --browser=chrome # use specific browser
playwright-cli open --mobile # emulate a generic mobile device
playwright-cli open --device="iPhone 15" # emulate a specific device
playwright-cli attach --extension=chrome # connect via Playwright Extension
playwright-cli attach --cdp=chrome # attach to running Chrome/Edge by channel
playwright-cli attach --cdp=<url> # attach via CDP endpoint
Expand Down Expand Up @@ -306,6 +310,13 @@ playwright-cli snapshot e34

# include each element's bounding box as [box=x,y,width,height]
playwright-cli snapshot --boxes

# search a large snapshot instead of capturing it all — returns matching nodes
# with 3 lines of context around each match (like grep -C)
playwright-cli find "Add to cart"
playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
# wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
playwright-cli find --regex "/sign (in|up)/i"
```

### Targeting elements
Expand Down Expand Up @@ -346,13 +357,13 @@ playwright-cli kill-all # forcefully kill all browser processes

### Local installation

If global `playwright-cli` command is not available, try a local version via `npx playwright-cli`:
If global `playwright-cli` command is not available, try a local version via `npx playwright cli`:

```bash
npx --no-install playwright-cli --version
npx --no-install playwright --version
```

When local version is available, use `npx playwright-cli` in all commands. Otherwise, install `playwright-cli` as a global command:
When local version is available, use `npx playwright cli` in all commands. Otherwise, install `playwright-cli` as a global command:

```bash
npm install -g @playwright/cli@latest
Expand Down Expand Up @@ -559,9 +570,8 @@ The installed skill includes detailed reference guides for common tasks:
* **Request mocking** — intercept and mock network requests
* **Running Playwright code** — execute arbitrary Playwright scripts
* **Browser session management** — manage multiple browser sessions
* **Spec-driven testing (plan / generate / heal)** — drive tests from a written spec
* **Storage state (cookies, localStorage)** — persist and restore browser state
* **Test generation** — generate Playwright tests from interactions
* **Test generation (plan / generate / heal)** — generate Playwright tests from a spec or interactions
* **Tracing** — record and inspect execution traces
* **Video recording** — capture browser session videos
* **Inspecting element attributes** — get element id, class, or any attribute not visible in the snapshot
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"test": "playwright test"
},
"devDependencies": {
"@playwright/test": "1.62.0-alpha-2026-06-29",
"@playwright/test": "1.62.0-alpha-2026-07-08",
"@types/node": "^25.2.1"
},
"dependencies": {
"playwright": "1.62.0-alpha-2026-06-29",
"playwright-core": "1.62.0-alpha-2026-06-29"
"playwright": "1.62.0-alpha-2026-07-08",
"playwright-core": "1.62.0-alpha-2026-07-08"
},
"bin": {
"playwright-cli": "playwright-cli.js"
Expand Down
25 changes: 20 additions & 5 deletions skills/playwright-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ playwright-cli upload ./document.pdf
playwright-cli check e12
playwright-cli uncheck e12
playwright-cli snapshot
# search the snapshot for text or a regexp, returns matching nodes with surrounding context
playwright-cli find "Sign in"
playwright-cli find --regex "Sign (in|up)"
# wrap the regexp in slashes to add flags, e.g. /i for case-insensitive
playwright-cli find --regex "/sign (in|up)/i"
playwright-cli eval "document.title"
playwright-cli eval "el => el.textContent" e5
# get element id, class, or any attribute not visible in the snapshot
Expand Down Expand Up @@ -210,6 +215,12 @@ playwright-cli open --browser=firefox
playwright-cli open --browser=webkit
playwright-cli open --browser=msedge

# Emulate a generic mobile device (Pixel 10 for Chromium, iPhone 17 for WebKit).
# Prefer this when a mobile layout is acceptable: mobile pages are usually
# lighter, so snapshots are smaller and cheaper.
playwright-cli open --mobile
playwright-cli open --device="iPhone 15"

# Use persistent profile (by default profile is in-memory)
playwright-cli open --persistent
# Use persistent profile with custom directory
Expand Down Expand Up @@ -279,6 +290,11 @@ playwright-cli snapshot e34

# include each element's bounding box as [box=x,y,width,height]
playwright-cli snapshot --boxes

# search a large snapshot instead of capturing it all — returns matching nodes
# with 3 lines of context around each match (like grep -C)
playwright-cli find "Add to cart"
playwright-cli find --regex "\\$[0-9]+\\.[0-9]{2}"
```

## Targeting elements
Expand Down Expand Up @@ -326,13 +342,13 @@ playwright-cli kill-all

## Installation

If global `playwright-cli` command is not available, try a local version via `npx playwright-cli`:
If global `playwright-cli` command is not available, try a local version via `npx playwright cli`:

```bash
npx --no-install playwright-cli --version
npx --no-install playwright --version
```

When local version is available, use `npx playwright-cli` in all commands. Otherwise, install `playwright-cli` as a global command:
When local version is available, use `npx playwright cli` in all commands. Otherwise, install `playwright-cli` as a global command:

```bash
npm install -g @playwright/cli@latest
Expand Down Expand Up @@ -397,9 +413,8 @@ playwright-cli show --annotate
* **Request mocking** [references/request-mocking.md](references/request-mocking.md)
* **Running Playwright code** [references/running-code.md](references/running-code.md)
* **Browser session management** [references/session-management.md](references/session-management.md)
* **Spec-driven testing (plan / generate / heal)** [references/spec-driven-testing.md](references/spec-driven-testing.md)
* **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md)
* **Test generation** [references/test-generation.md](references/test-generation.md)
* **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md)
* **Tracing** [references/tracing.md](references/tracing.md)
* **Video recording** [references/video-recording.md](references/video-recording.md)
* **Inspecting element attributes** [references/element-attributes.md](references/element-attributes.md)
Loading