$npx -y skills add disler/bowser --skill playwright-bowserHeadless browser automation using Playwright CLI. Use when you need headless browsing, parallel browser sessions, UI testing, screenshots, web scraping, or browser automation that can run in the background. Keywords - playwright, headless, browser, test, screenshot, scrape, paral
| 1 | # Playwright Bowser |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Automate browsers using `playwright-cli` — a token-efficient CLI for Playwright. Runs headless by default, supports parallel sessions via named sessions (`-s=`), and doesn't load tool schemas into context. |
| 6 | |
| 7 | ## Key Details |
| 8 | |
| 9 | - **Headless by default** — pass `--headed` to `open` to see the browser |
| 10 | - **Parallel sessions** — use `-s=<name>` to run multiple independent browser instances |
| 11 | - **Persistent profiles** — cookies and storage state preserved between calls |
| 12 | - **Token-efficient** — CLI-based, no accessibility trees or tool schemas in context |
| 13 | - **Vision mode** (opt-in) — set `PLAYWRIGHT_MCP_CAPS=vision` to receive screenshots as image responses in context instead of just saving to disk |
| 14 | |
| 15 | ## Sessions |
| 16 | |
| 17 | **Always use a named session.** Derive a short, descriptive kebab-case name from the user's prompt. This gives each task a persistent browser profile (cookies, localStorage, history) that accumulates across calls. |
| 18 | |
| 19 | ```bash |
| 20 | # Derive session name from prompt context: |
| 21 | # "test the checkout flow on mystore.com" → -s=mystore-checkout |
| 22 | # "scrape pricing from competitor.com" → -s=competitor-pricing |
| 23 | # "UI test the login page" → -s=login-ui-test |
| 24 | |
| 25 | playwright-cli -s=mystore-checkout open https://mystore.com --persistent |
| 26 | playwright-cli -s=mystore-checkout snapshot |
| 27 | playwright-cli -s=mystore-checkout click e12 |
| 28 | ``` |
| 29 | |
| 30 | Managing sessions: |
| 31 | ```bash |
| 32 | playwright-cli list # list all sessions |
| 33 | playwright-cli close-all # close all sessions |
| 34 | playwright-cli -s=<name> close # close specific session |
| 35 | playwright-cli -s=<name> delete-data # wipe session profile |
| 36 | ``` |
| 37 | |
| 38 | ## Quick Reference |
| 39 | |
| 40 | ``` |
| 41 | Core: open [url], goto <url>, click <ref>, fill <ref> <text>, type <text>, snapshot, screenshot [ref], close |
| 42 | Navigate: go-back, go-forward, reload |
| 43 | Keyboard: press <key>, keydown <key>, keyup <key> |
| 44 | Mouse: mousemove <x> <y>, mousedown, mouseup, mousewheel <dx> <dy> |
| 45 | Tabs: tab-list, tab-new [url], tab-close [index], tab-select <index> |
| 46 | Save: screenshot [ref], pdf, screenshot --filename=f |
| 47 | Storage: state-save, state-load, cookie-*, localstorage-*, sessionstorage-* |
| 48 | Network: route <pattern>, route-list, unroute, network |
| 49 | DevTools: console, run-code <code>, tracing-start/stop, video-start/stop |
| 50 | Sessions: -s=<name> <cmd>, list, close-all, kill-all |
| 51 | Config: open --headed, open --browser=chrome, resize <w> <h> |
| 52 | ``` |
| 53 | |
| 54 | ## Workflow |
| 55 | |
| 56 | 1. Derive a session name from the user's prompt and open with `--persistent` to preserve cookies/state. Always set the viewport via env var at launch: |
| 57 | ```bash |
| 58 | PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 playwright-cli -s=<session-name> open <url> --persistent |
| 59 | # or headed: |
| 60 | PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 playwright-cli -s=<session-name> open <url> --persistent --headed |
| 61 | # or with vision (screenshots returned as image responses in context): |
| 62 | PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 PLAYWRIGHT_MCP_CAPS=vision playwright-cli -s=<session-name> open <url> --persistent |
| 63 | ``` |
| 64 | |
| 65 | 3. Get element references via snapshot: |
| 66 | ```bash |
| 67 | playwright-cli snapshot |
| 68 | ``` |
| 69 | |
| 70 | 4. Interact using refs from snapshot: |
| 71 | ```bash |
| 72 | playwright-cli click <ref> |
| 73 | playwright-cli fill <ref> "text" |
| 74 | playwright-cli type "text" |
| 75 | playwright-cli press Enter |
| 76 | ``` |
| 77 | |
| 78 | 5. Capture results: |
| 79 | ```bash |
| 80 | playwright-cli screenshot |
| 81 | playwright-cli screenshot --filename=output.png |
| 82 | ``` |
| 83 | |
| 84 | 6. **Always close the session when done.** This is not optional — close the named session after finishing your task: |
| 85 | ```bash |
| 86 | playwright-cli -s=<session-name> close |
| 87 | ``` |
| 88 | |
| 89 | ## Configuration |
| 90 | |
| 91 | If a `playwright-cli.json` exists in the working directory, use it automatically. If the user provides a path to a config file, use `--config path/to/config.json`. Otherwise, skip configuration — the env var and CLI defaults are sufficient. |
| 92 | |
| 93 | ```json |
| 94 | { |
| 95 | "browser": { |
| 96 | "browserName": "chromium", |
| 97 | "launchOptions": { "headless": true }, |
| 98 | "contextOptions": { "viewport": { "width": 1440, "height": 900 } } |
| 99 | }, |
| 100 | "outputDir": "./screenshots" |
| 101 | } |
| 102 | ``` |
| 103 | |
| 104 | ## Full Help |
| 105 | |
| 106 | Run `playwright-cli --help` or `playwright-cli --help <command>` for detailed command usage. |
| 107 | |
| 108 | See [docs/playwright-cli.md](docs/playwright-cli.md) for full documentation. |