playwright cli

Engineering Community

Skill notes

Raw output

The global --raw option 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. Commands that don't produce output return nothing. For structured output wrapping every reply as JSON, pass --json

URLs with & on Windows

On Windows, cmd.exe and PowerShell treat & as a command separator, so URLs with multiple query parameters get truncated before playwright-cli runs. Escape & with ^& in cmd.exe, or use --% in PowerShell:

Snapshots

After each command, playwright-cli provides a snapshot of the current browser state. You can also take a snapshot on demand using playwright-cli snapshot command. All the options below can be combined as needed.

Targeting elements

By default, use refs from the snapshot to interact with page elements. You can also use css selectors or Playwright locators.

Installation

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

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Engineering
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@microsoft · no license declared
Token usage
Lean
Setup complexity
Guided setup
External API key
Not required
Operating systems
Windows
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
  • Shell exec
Network behavior
Local-only
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview playwright-cli.preview
# Raw output

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
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)
playwright-cli --raw localstorage-get theme

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.