Installation instructions · Download source code (ZIP)
Playwright CLI lets an assistant open pages, interact with elements and take browser screenshots through commands. Use it to check an interface on a demo site or a local project preview.
What you can use it for
For example, check that a menu opens, search works and an empty form shows an error. The assistant reads the page state, performs an action and compares the result with expectations.
The CLI suits an agent's current investigation. For tests that run automatically after each change, use Playwright Test. These are different tools, not two names for the same package.
How to install it
- The assistant checks Node.js and any existing
playwright-cli. The official Microsoft repository requires Node.js 18 or newer. - After approval, it installs the exact package
@playwright/cliand reads its help. - It opens a demo page without work accounts and checks that a page snapshot is available. If a browser or system dependencies are needed, it proposes that installation separately.
npm install -g @playwright/cli@latest
playwright-cli --help
The ZIP contains source code. A normal installation does not require building from that archive.
How to use it with Codex
With terminal access, Codex can call the CLI without a separate MCP connection. It reads --help first and uses commands supported by the installed version. The project also offers playwright-cli install --skills; before running it, the assistant checks the skill destination and compatibility with your client.
Demo check:
playwright-cli -s=bible-demo open https://demo.playwright.dev/todomvc/ --headed
playwright-cli -s=bible-demo snapshot
playwright-cli -s=bible-demo screenshot
playwright-cli -s=bible-demo close
The session name separates the demo from other browsers. snapshot supplies element references for later commands; do not copy references from someone else's example. --headed makes the browser window visible.
Where it helps
In checking a website after a change, the CLI can handle an agent's exploratory scenario: opening pages and checking menus or forms. For ongoing automated tests, that plan uses Playwright Test. Follow the general connection plan to set up an addition.
How to verify and finish
Ask the assistant to add a sample task to the demo list, confirm it appears and take a screenshot. Check form and menu behavior by interacting, not just reading HTML. Refresh the snapshot after page changes: element references may change.
Command not found: check installation and the executable path. Browser startup failure: read the error and check the required browser build. Close sessions by name rather than closing all browsers. Saved profiles may contain cookies: do not commit them or use a work account for the first test.
The result is a checked scenario and screenshots. For regular verification, continue with the project checking and repair plan.
Prompt for browser verification
Paste into Codex with terminal access:
Find the current project and its available local site preview. Check for an authorized browser-control method. If this task needs Playwright CLI, read Microsoft's official README, check Node.js and the existing installation. Ask approval before a new installation or adding a skill.
Read the installed CLI help and create a separate named demo session without my work accounts. Check a menu, search or form for the selected task: read the page state, perform an action and verify the result. Find current element references yourself. Do not send real leads or make payments.
Take before-and-after screenshots, check a narrow window and save findings with reproduction steps. Close only the session you created. If repeatable automated tests are needed, propose Playwright Test separately.