| name | playwright-cli |
| description | Use this whenever the user asks to browse, navigate, click, fill a form,
scrape, take a screenshot, or otherwise interact with a web page. SLICC drives
the browser through the `playwright-cli` shell command (also aliased as
`playwright` and `puppeteer`). Read this BEFORE running any browser
automation: every tab-operating command requires a `--tab` target id, and
multi-agent tab handling has rules you must follow.
|
| allowed-tools | bash |
Browser Automation via playwright-cli
Use playwright-cli (also aliased as playwright and puppeteer) via the bash tool for all browser automation.
Every tab-operating command requires --tab=<targetId>. There is no implicit "current tab". Always specify which tab you're operating on.
Quick Start
playwright-cli open https://example.com
playwright-cli snapshot --tab=E9A3F
playwright-cli click --tab=E9A3F e5
playwright-cli fill --tab=E9A3F e12 "hello world"
playwright-cli snapshot --tab=E9A3F
Tab IDs
tab-list shows all tabs with their targetIds. The user's active tab is marked (active).
tab-new / open return the new tab's targetId — capture it for subsequent commands.
- Use
--tab=<targetId> on ALL commands that operate on a tab.
Common Failure Modes
--tab <targetId> is required — you forgot --tab=<id>. Run tab-list to get IDs.
No snapshot available — run snapshot --tab=<id> before using refs.
- Refs are tied to one tab + one snapshot. They do not carry across tabs, navigations, or reloads.
Element Refs
Snapshots assign short ref IDs (e1, e2, ...) to interactive elements. Use these refs with click, fill, dblclick, hover, select, check, uncheck, drag, and screenshot.
Refs are invalidated after any state-changing command. Always re-snapshot to get fresh refs.
Commands
All commands below that operate on a tab require --tab=<targetId>.
Core
playwright-cli open [url] [--foreground]
playwright-cli tab-new [url] [--foreground]
playwright-cli tab-close --tab=<id>
playwright-cli goto --tab=<id> <url>
playwright-cli navigate --tab=<id> <url>
playwright-cli snapshot --tab=<id> [--filename=path]
playwright-cli snapshot --tab=<id> --no-iframes
playwright-cli eval --tab=<id> <expression>
playwright-cli eval-file --tab=<id> <vfs-path>
playwright-cli frames --tab=<id>
playwright-cli resize --tab=<id> <width> <height>
--foreground (or --fg) opens the new tab focused instead of in the background.
Interaction
playwright-cli click --tab=<id> <ref>
playwright-cli dblclick --tab=<id> <ref> [button]
playwright-cli fill --tab=<id> <ref> <text>
playwright-cli type --tab=<id> <text>
playwright-cli hover --tab=<id> <ref>
playwright-cli select --tab=<id> <ref> <value>
playwright-cli check --tab=<id> <ref>
playwright-cli uncheck --tab=<id> <ref>
playwright-cli drag --tab=<id> <startRef> <endRef>
playwright-cli dialog-accept --tab=<id> [text]
playwright-cli dialog-dismiss --tab=<id>
Keyboard
playwright-cli press --tab=<id> <key>
Navigation
playwright-cli go-back --tab=<id>
playwright-cli go-forward --tab=<id>
playwright-cli reload --tab=<id>
Teleport
playwright-cli teleport --tab=<id> --start=<regex> --return=<regex> [--timeout=<s>]
playwright-cli teleport --list
playwright-cli teleport --off --tab=<id>
playwright-cli open <url> --teleport-start=<regex> --teleport-return=<regex>
playwright-cli goto --tab=<id> <url> --teleport-start=<regex> --teleport-return=<regex>
Teleport is for leader/follower tray auth handoffs. Scoped to a specific tab — only commands targeting the teleporting tab are blocked; other tabs remain operational.
Screenshots
playwright-cli screenshot --tab=<id>
playwright-cli screenshot --tab=<id> --filename=page.png
playwright-cli screenshot --tab=<id> e5
playwright-cli screenshot --tab=<id> --fullPage
playwright-cli screenshot --tab=<id> --max-width=800
Viewing pages and screenshots yourself
The browser displays things to the human; open --view is what lets you see them. But viewing screenshots is a last resort for the cone — every image you load eats a large chunk of the context window (a single 1280×800 PNG can run 1500+ tokens, full-page screenshots much more). Reach for cheaper signals first:
playwright-cli snapshot --tab=<id> — text accessibility tree. Use this first; it answers "what's on the page" for almost all verification tasks at a tiny fraction of the token cost.
eval against the DOM — when you need a specific value (document.title, an attribute, computed style), eval it. Don't screenshot for facts you can extract.
- Delegate visual inspection to a scoop. If the cone genuinely needs vision (layout regression, render fidelity, "does this look right"), spawn a scoop to take and view the screenshot — the scoop's context absorbs the tokens, and you receive its summary back. The cone's window stays clean for orchestration.
open --view in the cone — only when the cone itself must see pixels for its current decision and steps 1–3 won't do.
What you CAN see:
open --view <path> — reads an image from the VFS and returns it. Works with PNG, JPEG, GIF, WebP, SVG.
playwright-cli screenshot --tab=<id> + open --view <path> — screenshot a tab, then view it.
screencapture --view screenshot.png — capture the user's screen via browser screen sharing.
playwright-cli snapshot --tab=<id> — accessibility tree (text). Use to verify content without vision.
What only the human sees:
serve <dir> — opens an app directory in a browser tab.
open <path> (no flags) — opens a file in a browser tab.
imgcat <path> — displays an image in the terminal preview.
Workflow to verify a page (when vision is actually required):
serve /workspace/app — open the app (the human sees it).
playwright-cli tab-list — find the tab by URL, note the targetId.
playwright-cli snapshot --tab=<id> — required before screenshot, and often answers your question on its own.
playwright-cli screenshot --tab=<id> --filename=/tmp/shot.png — consider --max-width to keep the file small.
open --view /tmp/shot.png — now you can see it. Strongly prefer doing this from a scoop, not the cone.
Don't:
- Default to screenshots when a snapshot would do.
read_file on a PNG or base64-encode to view images.
imgcat or cat on screenshots expecting to see them.
- Open a screenshot then screenshot that tab.
- Use
eval to check the active tab — use tab-list.
Tab Management
playwright-cli tab-list
playwright-cli tab-new [url]
playwright-cli tab-close --tab=<id>
Cookies
playwright-cli cookie-list --tab=<id>
playwright-cli cookie-get --tab=<id> <name>
playwright-cli cookie-set --tab=<id> <name> <value> [flags]
playwright-cli cookie-delete --tab=<id> <name> [--domain= --path=]
playwright-cli cookie-clear --tab=<id>
localStorage / sessionStorage
playwright-cli localstorage-list --tab=<id>
playwright-cli localstorage-get --tab=<id> <key>
playwright-cli localstorage-set --tab=<id> <key> <value>
playwright-cli localstorage-delete --tab=<id> <key>
playwright-cli localstorage-clear --tab=<id>
HAR Recording
playwright-cli record [url] [--filter=<js-expr>]
playwright-cli stop-recording <recordingId>
Multi-Agent Tab Behavior
All agents (cone + scoops) share the same tab namespace. There is no tab isolation.
tab-list shows every tab from every agent — yours, the cone's, other scoops'. The list can be noisy.
- Any agent can
eval, snapshot, or close any tab — there are no ownership checks.
- Tab counts fluctuate as other agents open and close tabs concurrently.
Best practices for scoops:
-
Track your own tab IDs. When you open a tab, capture the targetId and store it. Don't rely on tab-list to find your tabs later — other agents' tabs will be mixed in.
playwright-cli tab-new https://example.com
-
NEVER close tabs you didn't open. Tabs you don't recognize belong to the user or other agents. User tabs are off-limits unless the user explicitly asks you to close them. Only close tabs whose targetId you captured from your own tab-new / open calls.
-
Handle "tab not found" gracefully. Another agent might close a tab between your tab-list and your command. If you get Error: No tab with id, the tab is gone — move on.
-
Don't depend on tab count or ordering. Other agents are opening/closing tabs concurrently. Use targetIds, not positional logic.
-
Clean up when done. Close all tabs you opened before finishing. Include this in every scoop brief:
"Close each tab with playwright-cli tab-close --tab=<id> when done."
Tips
- Refs change after every interaction — always re-snapshot before clicking or filling.
open and tab-new open tabs in the background by default. Capture the targetId from the output.
- After
click, fill, goto, go-back, go-forward, reload, select, check, uncheck, drag, or dialog-*, take a fresh snapshot --tab=<id> before using refs again.
- Unexpected JavaScript dialogs are auto-dismissed on attached pages.
- Use
eval --tab=<id> for DOM operations not covered by built-in commands.
- The SLICC app tab and Chrome internal UI tabs are automatically excluded from
tab-list.
fill clears and types into regular inputs, textareas, and contenteditable elements.
- Screenshots default to
/tmp/screenshot-<timestamp>.png. Use --filename=path to save elsewhere.
Low-level CDP escape hatch
For raw Chrome DevTools Protocol calls that playwright-cli doesn't wrap, send JSON-RPC directly over WebSocket with websocat:
curl -s http://127.0.0.1:9222/json | jq -r '.[0].webSocketDebuggerUrl'
echo 'Page.navigate {"url":"https://example.com"}' \
| websocat -1 --jsonrpc --jsonrpc-omit-jsonrpc ws://127.0.0.1:9222/devtools/page/<id>
Run websocat --help for the full flag list. Use this only when playwright-cli has no wrapper for the CDP method you need.