agentleFS
PanPanFRPanPanFR/oh-my-openkilo/skills/playwright-cli/SKILL.md

playwright-cli

Skill9 starsChanged 3 months agoMITView on GitHub

Use when automating browser interactions, E2E tests, web scraping, snapshotting, request mocking, or Playwright test generation/debug. Triggers on "open browser", "click button", "fill form", "take screenshot", "run playwright test", "playwright-cli", "@playwright/cli", or tasks needing persistent browser sessions.

  • Installs packages

88 other projects use a version of this, 73 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use playwright-ci, playwright-migration and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • zebbernSkill

    playwright-ci

    Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

    Also in 3 projects that use this

  • zebbernSkill

    playwright-migration

    Step-by-step migration guides for moving to Playwright from Cypress or Selenium/WebDriver — command mappings, architecture changes, and incremental adoption strategies.

    Also in 3 projects that use this

  • MicrosoftSkill

    aspire

    Orchestrates Aspire distributed applications using the Aspire CLI for running, debugging, and managing distributed apps. USE FOR: aspire start, aspire stop, start aspire app, aspire describe, list aspire integrations, debug aspire issues, view aspire logs, add aspire resource, aspire dashboard, update aspire apphost. DO NOT USE FOR: non-Aspire .NET apps (use dotnet CLI), container-only deployments (use docker/podman), Azure deployment after local testing (use azure-deploy skill). INVOKES: Aspire CLI commands (aspire start, aspire describe, aspire otel logs, aspire docs search, aspire add), bash. FOR SINGLE OPERATIONS: Use Aspire CLI commands directly for quick resource status or doc lookups.

    Also in 3 projects that use this

  • CommandCodeAISkill

    playwright-skill

    Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.

    Also in 4 projects that use this

  • rogue-dev-studioSkill

    github-cli

    GitHub CLI authentication and workflow configuration. Use when the project needs this capability or the user / team manifest asks for it. Use for specialized `github-cli` work when listed in TEAM.yaml or explicitly requested.

    Also in 3 projects that use this

  • OpenAISkill

    image-to-code

    Implement a selected image, screenshot, mockup, or Image Gen reference as a faithful, responsive frontend.

    Also in 5 projects that use this

  • +1 more from zebbern

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 78 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After each command, playwright-cli prints a snapshot of current state:

    line 128
  2. Very specific:

    Use refs from snapshot (e1, e2, ...) to target elements.

    line 139
  3. Very specific:

    If global is not in PATH, use local: npx --no-install playwright --version.

    line 261

“Common” is measured: kept by at least 6 in 10 of the 78 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Browser Automation with playwright-cli

Token-efficient CLI for Playwright. Use when automation load is high (many page reads, big snapshots) and MCP tool schemas eat too much context. For small ad-hoc inspects, prefer chrome-devtools MCP.

Invoke via bash tool. Example: playwright-cli open https://example.com. Opencode runs these directly; the model never sees a heavy MCP tool schema for the browser.

Quick start

playwright-cli open                                  # new browser
playwright-cli open https://example.com              # open + navigate
playwright-cli goto https://playwright.dev
playwright-cli snapshot                              # get refs (e1, e2, ...)
playwright-cli click e15
playwright-cli type "page.click"
playwright-cli press Enter
playwright-cli screenshot                            # rarely needed; snapshot > screenshot
playwright-cli close

Core commands

playwright-cli open [url]              # open browser, optionally navigate
playwright-cli goto <url>              # navigate
playwright-cli snapshot                # a11y tree with element refs
playwright-cli snapshot e5             # snapshot a specific element
playwright-cli snapshot --depth=4      # limit depth
playwright-cli snapshot --boxes        # include bounding boxes
playwright-cli find "Sign in"          # search snapshot (returns matching nodes + context)
playwright-cli find --regex "Sign (in|up)"
playwright-cli find --regex "/sign (in|up)/i"    # slashes = flags
playwright-cli click <ref> [button]    # click (default left)
playwright-cli dblclick <ref> [button]
playwright-cli hover <ref>
playwright-cli type <text>             # type into focused element
playwright-cli fill <ref> <text>       # fill input
playwright-cli fill <ref> <text> --submit   # fill + press Enter
playwright-cli press <key>            # Enter, ArrowDown, a, Control+A, ...
playwright-cli keydown <key> / keyup <key>
playwright-cli select <ref> <value>    # dropdown
playwright-cli check <ref> / uncheck <ref>
playwright-cli drag <fromRef> <toRef>
playwright-cli drop <ref> --path=./file.png   # drop file from outside page
playwright-cli drop <ref> --data="text/plain=hello"
playwright-cli upload <file...>
playwright-cli eval "document.title"                 # JS on page
playwright-cli eval "el => el.textContent" e5       # JS on element
playwright-cli dialog-accept [prompt] / dialog-dismiss
playwright-cli resize <w> <h>
playwright-cli close
playwright-cli go-back / go-forward / reload
playwright-cli mousemove <x> <y>
playwright-cli mousedown [button] / mouseup [button]
playwright-cli mousewheel <dx> <dy>
playwright-cli screenshot [ref] [--filename=f.png] [--hires]
playwright-cli pdf [--filename=page.pdf]
playwright-cli tab-list / tab-new [url] / tab-close [idx] / tab-select <idx>

Storage

playwright-cli state-save [file] / state-load <file>

playwright-cli cookie-list [--domain=...] [--path=...]
playwright-cli cookie-get <name>
playwright-cli cookie-set <name> <val> [--domain=...] [--httpOnly] [--secure] [--sameSite=Lax] [--expires=unix]
playwright-cli cookie-delete <name>
playwright-cli cookie-clear

playwright-cli localstorage-list / get <k> / set <k> <v> / delete <k> / clear
playwright-cli sessionstorage-list / get <k> / set <k> <v> / delete <k> / clear

Network

playwright-cli route "<pattern>" [--status=N] [--body=...] [--content-type=...] [--header="K: V"] [--remove-header=h1,h2]
playwright-cli route-list
playwright-cli unroute [<pattern>]      # no arg = remove all

Patterns: **/*.jpg, **/api/*/details, **/*.{png,jpg}, **/search?q=*.

DevTools

playwright-cli console [level]            # level: error|warning|info|debug
playwright-cli requests / request <idx>
playwright-cli run-code "async page => { ... }"      # arbitrary Playwright code
playwright-cli run-code --filename=./script.js
playwright-cli tracing-start / tracing-stop
playwright-cli video-start [file.webm]
playwright-cli video-chapter "<title>" [--description=...] [--duration=ms]
playwright-cli video-show-actions [--duration=ms] [--position=top-right]
playwright-cli video-hide-actions
playwright-cli video-stop
playwright-cli show [--annotate]          # open visual dashboard
playwright-cli generate-locator <ref> [--raw]
playwright-cli highlight <ref> [--style="outline: 3px dashed red"] [--hide]

Open parameters

playwright-cli open --browser=chrome|firefox|webkit|msedge
playwright-cli open --mobile                              # generic mobile (lighter snapshots)
playwright-cli open --device="iPhone 15"
playwright-cli open --persistent                          # profile persisted to disk
playwright-cli open --profile=/path/to/profile
playwright-cli open --headed
playwright-cli open --config=./.playwright/cli.config.json
playwright-cli attach --extension=chrome                  # Playwright extension
playwright-cli attach --cdp=chrome|msedge                 # running browser by channel
playwright-cli attach --cdp=http://localhost:9222         # CDP endpoint
playwright-cli detach                                    # leave external browser running
playwright-cli delete-data                               # wipe default session data

Snapshots and refs

After each command, playwright-cli prints a snapshot of current state:

> playwright-cli goto https://example.com
### Page
- Page URL: https://example.com/
- Page Title: Example Domain
### Snapshot
[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)

Use refs from snapshot (e1, e2, ...) to target elements. CSS selectors and Playwright locators also work:

playwright-cli click "#main > button.submit"
playwright-cli click "getByRole('button', { name: 'Submit' })"
playwright-cli click "getByTestId('submit-button')"

Sessions (concurrent, isolated)

playwright-cli -s=auth open https://app.example.com/login
playwright-cli -s=public open https://example.com
playwright-cli -s=auth fill e1 "user@example.com"
playwright-cli -s=public snapshot
playwright-cli list                    # list all sessions
playwright-cli close                   # stop default
playwright-cli -s=auth close           # stop named
playwright-cli close-all
playwright-cli kill-all                # force-kill zombies
playwright-cli -s=auth delete-data     # wipe session profile
export PLAYWRIGHT_CLI_SESSION=mysession    # default session via env

Raw output

--raw strips page status / generated code / snapshot sections; returns just the result. Use to pipe into other tools.

playwright-cli --raw eval "JSON.stringify(performance.timing)" | jq '.loadEventEnd - .navigationStart'
playwright-cli --raw snapshot > before.yml
playwright-cli click e5
playwright-cli --raw snapshot > after.yml
diff before.yml after.yml
TOKEN=$(playwright-cli --raw cookie-get session_id)

--json wraps every reply as JSON: playwright-cli list --json.

Windows & gotcha

cmd.exe and PowerShell treat & as command separator → URL with multiple query params gets truncated.

playwright-cli goto "https://example.com/?a=1^&b=2"
playwright-cli --% goto "https://example.com/?a=1&b=2"

MCP choice (opencode)

NeedUse
Many page reads, big snapshots, low context budgetplaywright-cli via bash (this skill)
Quick live inspect / debug / Lighthouse / perf tracechrome-devtools MCP
Cheap file-based screenshot/DOM peekchrome-devtools MCP

Reference docs (load on demand)

TopicFile
Run/debug Playwright testsreferences/playwright-tests.md
Request mocking (route, run-code patterns)references/request-mocking.md
Arbitrary Playwright code via run-codereferences/running-code.md
Concurrent browser sessions, attach, persistentreferences/session-management.md
Cookies, localStorage, sessionStorage, storage statereferences/storage-state.md
Test generation (plan / generate / heal)references/test-generation.md
Tracing (.trace files, DOM snapshots)references/tracing.md
Video recording + overlay/chapter APIreferences/video-recording.md
Inspect hidden element attributes (id, class, data-*)references/element-attributes.md

Examples

Form submit:

playwright-cli open https://example.com/form
playwright-cli snapshot
playwright-cli fill e1 "user@example.com"
playwright-cli fill e2 "password123"
playwright-cli click e3
playwright-cli snapshot
playwright-cli close

Multi-tab:

playwright-cli open https://example.com
playwright-cli tab-new https://example.com/other
playwright-cli tab-list
playwright-cli tab-select 0
playwright-cli close

DevTools debug:

playwright-cli open https://example.com
playwright-cli click e4
playwright-cli fill e7 "test"
playwright-cli console
playwright-cli requests
playwright-cli close

Interactive UI review (user annotates page):

playwright-cli open https://example.com
playwright-cli show --annotate

Install (already done globally; kept for reference)

npm install -g @playwright/cli@latest
playwright-cli --help

If global is not in PATH, use local: npx --no-install playwright --version. Otherwise the global install above is required.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.