$npx -y skills add gaia-react/gaia --skill playwright-cliAutomates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
| 1 | # Browser Automation with playwright-cli |
| 2 | |
| 3 | ## Quick start |
| 4 | |
| 5 | ```bash |
| 6 | # open new browser |
| 7 | playwright-cli open |
| 8 | # navigate to a page |
| 9 | playwright-cli goto https://playwright.dev |
| 10 | # interact with the page using refs from the snapshot |
| 11 | playwright-cli click e15 |
| 12 | playwright-cli type "page.click" |
| 13 | playwright-cli press Enter |
| 14 | # take a screenshot (rarely used, as snapshot is more common) |
| 15 | playwright-cli screenshot |
| 16 | # close the browser |
| 17 | playwright-cli close |
| 18 | ``` |
| 19 | |
| 20 | ## How interaction refs work |
| 21 | |
| 22 | After every command, playwright-cli emits a snapshot file (`.playwright-cli/page-*.yml`). Element refs (`e3`, `e7`, `e15`) come from that snapshot, read it before the next interactive command. Use `playwright-cli snapshot` to refresh on demand. |
| 23 | |
| 24 | ```bash |
| 25 | > playwright-cli goto https://example.com |
| 26 | ### Page |
| 27 | - Page URL: https://example.com/ |
| 28 | - Page Title: Example Domain |
| 29 | ### Snapshot |
| 30 | [Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml) |
| 31 | ``` |
| 32 | |
| 33 | If `--filename` is not provided, a new snapshot file is created with a timestamp. Default to automatic file naming; use `--filename=` when the artifact is part of the workflow result. |
| 34 | |
| 35 | ## Local installation fallback |
| 36 | |
| 37 | If running globally-available `playwright-cli` fails, prefix with `npx`: |
| 38 | |
| 39 | ```bash |
| 40 | npx playwright-cli open https://example.com |
| 41 | npx playwright-cli click e1 |
| 42 | ``` |
| 43 | |
| 44 | ## Browser sessions |
| 45 | |
| 46 | Use `-s=<name>` to run multiple parallel sessions: |
| 47 | |
| 48 | ```bash |
| 49 | playwright-cli -s=mysession open example.com --persistent |
| 50 | playwright-cli -s=mysession click e6 |
| 51 | playwright-cli -s=mysession close |
| 52 | playwright-cli list # list active sessions |
| 53 | playwright-cli close-all # close every browser |
| 54 | ``` |
| 55 | |
| 56 | ## Command reference |
| 57 | |
| 58 | Full surface, core, navigation, keyboard, mouse, save-as, tabs, storage (cookies / localStorage / sessionStorage), network, devtools, open parameters, snapshots, browser sessions, end-to-end examples, is in [references/commands.md](references/commands.md). |
| 59 | |
| 60 | ## Specific tasks |
| 61 | |
| 62 | - **Request mocking**: [references/request-mocking.md](references/request-mocking.md) |
| 63 | - **Running Playwright code**: [references/running-code.md](references/running-code.md) |
| 64 | - **Browser session management**: [references/session-management.md](references/session-management.md) |
| 65 | - **Storage state (cookies, localStorage)**: [references/storage-state.md](references/storage-state.md) |
| 66 | - **Test generation**: [references/test-generation.md](references/test-generation.md) |
| 67 | - **Tracing**: [references/tracing.md](references/tracing.md) |
| 68 | - **Video recording**: [references/video-recording.md](references/video-recording.md) |