Skip to content
Skills Library
Programming · Automation

playwright-cli

/playwright-cli

Browser automation via Playwright CLI for navigating pages, interacting with elements, capturing screenshots, and testing web applications through shell commands. Use when user mentions "playwright", "browser automation", "take a screenshot", "browser testing", "headless browser", "web testing", "fill out a form", "e2e test", or needs to automate browser workflows from the command line. This is a pre-installed CLI tool — do NOT install anything via npx or npm. Invoke this skill first, then use playwright-cli bash commands.

Licence
MIT
Last repository change
14.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
10
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 14.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Browser automation via Playwright CLI for navigating pages, interacting with elements, capturing screenshots, and testing web applications through shell commands. Use when user mentions "playwright", "browser automation", "take a screenshot", "browser testing", "headless browser", "web testing", "fill out a form", "e2e test", or needs to automate browser workflows from the command line. This is a pre-installed CLI tool — do NOT install anything via npx or npm. Invoke this skill first, then use playwright-cli bash commands.

Triggers from the description

playwrightbrowser automationtake a screenshotbrowser testingheadless browserweb testingfill out a forme2e test
Original author description

Browser automation via Playwright CLI for navigating pages, interacting with elements, capturing screenshots, and testing web applications through shell commands. Use when user mentions "playwright", "browser automation", "take a screenshot", "browser testing", "headless browser", "web testing", "fill out a form", "e2e test", or needs to automate browser workflows from the command line. This is a pre-installed CLI tool — do NOT install anything via npx or npm. Invoke this skill first, then use playwright-cli bash commands.

How it works

  1. Core Workflow
  2. Command Reference
  3. Sessions
  4. Configuration
  5. Common Pitfalls
  6. Resources
Original SKILL.md headings · 137 lines, 723 words
SKILL.md preview
---
name: playwright-cli
description: >-
  Browser automation via Playwright CLI for navigating pages, interacting with
  elements, capturing screenshots, and testing web applications through shell
  commands. Use when user mentions "playwright", "browser automation",
  "take a screenshot", "browser testing", "headless browser", "web testing",
  "fill out a form", "e2e test", or needs to automate browser workflows
  from the command line. This is a pre-installed CLI tool — do NOT install
  anything via npx or npm. Invoke this skill first, then use playwright-cli
  bash commands.
allowed-tools: Bash(playwright-cli:*)
---

# Playwright CLI

Automate browsers through shell commands via the Bash tool.

## Core Workflow

Every interaction follows this pattern:

1. **Open** a page: `playwright-cli open <url>`
2. **Snapshot** to discover elements: `playwright-cli snapshot`
3. **Interact** using refs from the snapshot: `playwright-cli click <ref>`
4. **Verify** the result: `playwright-cli screenshot` or `playwright-cli snapshot`

Always run `snapshot` before interacting — element refs come exclusively from
snapshot output and become stale after navigation.

## Command Reference

### Navigation

| Command | Description |
|---------|-------------|
| `open <url>` | Open URL in new page |
| `goto <url>` | Navigate current page |
| `go-back` / `go-forward` | Browser back/forward |
| `reload` | Reload current page |
| `close` | Close the browser |

### Interaction

| Command | Description |
|---------|-------------|
| `click <ref>` | Click an element |
| `dblclick <ref>` | Double-click an element |
| `fill <ref> <text>` | Clear field, then type text |
| `type <text>` | Type into focused element (appends) |
| `check <ref>` / `uncheck <ref>` | Toggle checkbox |
| `select <ref> <values>` | Select dropdown option(s) |
| `hover <ref>` | Hover over element |
| `drag <start> <end>` | Drag between elements |
| `upload <ref> <paths>` | Upload file(s) to file input |
| `eval "<js>"` | Evaluate JavaScript on page |
| `eval "<js>" <ref>` | Evaluate JavaScript on element |
| `dialog-accept [text]` | Accept dialog (optional prompt text) |
| `dialog-dismiss` | Dismiss dialog |
| `resize <w> <h>` | Resize browser window |

### Output

| Command | Description |
|---------|-------------|
| `screenshot [ref] [--filename=f]` | Capture PNG screenshot (page or element) |
| `snapshot [--filename=f]` | Accessibility tree — structured, token-efficient |
| `pdf [--filename=f]` | Generate PDF of the page |

> **Important:** `--filename` resolves relative to the working directory, NOT `outputDir`.
> When using `--filename`, always prepend the project's `outputDir` value
> (check `.playwright/cli.config.json`; defaults to `.playwright-cli`).
> Example: `playwright-cli screenshot --filename=<outputDir>/my-screenshot.png`

### Tabs

| Command | Description |
|---------|-------------|
| `tab list` | List open tabs |
| `tab create [url]` | Open new tab |
| `tab select <index>` | Switch to tab |
| `tab close [index]` | Close tab |

### Keyboard

```bash
playwright-cli press Enter          # Enter, Tab, Escape, ArrowDown, etc.
playwright-cli keydown Shift         # Hold key down
playwright-cli keyup Shift           # Release key
```

### Mouse

```bash
playwright-cli mousemove 150 300     # Move to coordinates
playwright-cli mousedown [button]    # Press button (left/right)
playwright-cli mouseup [button]      # Release button
playwright-cli mousewheel 0 100      # Scroll (deltaX deltaY)
```

## Sessions

- **Default session** — all commands share one session automatically
- **Named sessions** — `playwright-cli -s=<name> open <url>` for parallel browsers
- **List sessions** — `playwright-cli list`
- **Close one** — `playwright-cli -s=<name> close`
- **Close all** — `playwright-cli close-all`
- **Force kill** — `playwright-cli kill-all`
- **Persistent profile** — `playwright-cli open <url> --persistent`
- **Custom profile** — `playwright-cli open <url> --profile=/path/to/dir`
- **Delete data** — `playwright-cli delete-data` or `playwright-cli -s=<name> delete-data`
- **Environment variable** — `PLAYWRIGHT_CLI_SESSION=my-project`

## Configuration

```bash
playwright-cli open <url> --browser=chromium    # chromium (default), firefox, webkit, chrome, msedge
playwright-cli open <url> --headed              # Visible browser window
playwright-cli open <url> --config=config.json  # Custom config file
playwright-cli open <url> --extension           # Connect via browser extension
```

Create `.playwright/cli.config.json` in the project for persistent settings:

```json
{ "browser": { "browserName": "chromium", "launchOptions": { "headless": true } }, "outputDir": ".playwright-cli", "timeouts": { "action": 5000, "navigation": 60000 } }
```

Other options: `network.allowedOrigins`, `network.blockedOrigins`, `saveVideo`.
Environment variables use `PLAYWRIGHT_MCP_` prefix (e.g., `PLAYWRIGHT_MCP_BROWSER=firefox`).

## Common Pitfalls

- **Interacting without snapshot** — refs are unknown until `snapshot` runs
- **Stale refs after navigation** — re-run `snapshot` after `goto`, link clicks, or form submissions
- **fill vs type** — `fill` clears the field first; `type` appends to current content
- **Stuck sessions** — run `playwright-cli kill-all` to force-close all browsers

## Resources

- [EXAMPLES.md](EXAMPLES.md) — Multi-step workflow examples
- [TROUBLESHOOTING.md](TROUBLESHOOTING.md) — Error diagnosis and fixes
- [references/request-mocking.md](references/request-mocking.md) — Intercept, mock, and block network requests
- [references/running-code.md](references/running-code.md) — Execute arbitrary Playwright code via `run-code`
- [references/session-management.md](references/session-management.md) — Named sessions, isolation, concurrent browsers
- [references/storage-state.md](references/storage-state.md) — Cookies, localStorage, sessionStorage management
- [references/test-generation.md](references/test-generation.md) — Generate Playwright test code from CLI actions
- [references/tracing.md](references/tracing.md) — Capture execution traces for debugging
- [references/video-recording.md](references/video-recording.md) — Record browser sessions as WebM video
Files in this package (10)
  • EXAMPLES.md 6 KB
  • SKILL.md 6 KB
  • TROUBLESHOOTING.md 5 KB
  • references/request-mocking.md 2 KB
  • references/running-code.md 6 KB
  • references/session-management.md 4 KB
  • references/storage-state.md 5 KB
  • references/test-generation.md 2 KB
  • references/tracing.md 4 KB
  • references/video-recording.md 1 KB

Versions

RepositoryScoreLicence
This page · joaquimscosta/arkhe-claude-plugins100MIT
atc-net/atc-agentic-toolkit100MIT
thefrederiksen/devthrottle100MIT
zebbern/claude-code-guide100MIT
sanity-io/sanity100MIT
fugazi/test-automation-skills-agents100MIT
laurigates/claude-plugins100MIT
ulises-jeremias/agent-toolkit100MIT
testdino-hq/playwright-skill100MIT

Database snapshot: 13.11.2026 · package version 7a9021229eab (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100playwright-automation
    Browser automation via Playwright for web testing, screenshots, form filling, scraping, and verification. Use when tasks require navigating websites, interacting with web pages, or testing web applications.
  • 100ac-qa-playwright-cli
    Browser automation via playwright-cli. Token-efficient alternative to Playwright MCP - uses CLI commands through Bash instead of MCP tool schemas. Supports navigation, interaction, screenshots, video recording, and session management. Triggers on keywords: browser, e2e,…
  • 100playwright-testing
    UI/E2E test automation with Playwright MCP. Use when the user asks to "test the UI", "automate browser tests", "check the page", "take a screenshot", "run Playwright", "write E2E tests", or anything about browser-based testing.
  • 100dev-browser
    Browser automation with a persistent session, driven by the Playwright Python API. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out…
  • 100playwright-automation
    Browser automation and testing with Playwright. Use when testing web applications, automating browser tasks, taking screenshots, or validating UI behavior.
  • 100mcp-playwright
    This skill provides guidance for using Playwright MCP for browser automation. Use when navigating web pages, interacting with web elements, taking screenshots, filling forms, running browser tests, or automating any browser-based tasks.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.