Repolode
microsoft

microsoft/playwright-cli

A command-line interface for Playwright browser automation, designed for coding agents to drive browsers through short shell commands and skills.

Stars
15,028
Forks
903
Open issues
21
Last commit
2 days ago

What is it?

playwright-cli exposes common Playwright browser actions as shell commands. Coding agents such as Claude Code or GitHub Copilot can open pages, click and fill elements, take screenshots, record user actions as Playwright code, and inspect selectors without loading large tool schemas into the model context. Developers can also run the same commands by hand to explore a site or debug a flow.

The tool keeps browser state across calls within named sessions, so cookies and storage survive between commands until the browser closes. Sessions can persist to disk, run headed or headless, and be listed, closed, or monitored through a visual dashboard. Elements are targeted by snapshot refs, CSS selectors, or Playwright locators.

Beyond interaction, it covers tracing, video recording, network route mocking, storage and cookie management, device and color-scheme emulation, and an experimental WebMCP tool-calling interface. Configuration is available through a JSON file or environment variables. It requires Node.js 18 or newer.

Key features

  • 01Runs common Playwright actions such as click, fill, navigate and screenshot from the shell.
  • 02Records browser actions and generates equivalent Playwright code.
  • 03Keeps isolated, named browser sessions with optional persistent profiles.
  • 04Provides a visual dashboard to watch and take over running sessions.
  • 05Supports tracing, video recording, and network request mocking.
  • 06Accepts element refs, CSS selectors, or Playwright locators as targets.

Use cases

  • Letting a coding agent test a web app flow and capture screenshots of passing and failing steps.
  • Debugging a page interactively by running commands by hand against a visible browser.
  • Recording a user flow and converting it into Playwright test code.
  • Inspecting selectors and element attributes while writing end-to-end tests.

Quick start

  1. 1

    Install the CLI globally with npm

    npm install -g @playwright/cli@latest
  2. 2

    Install the agent skills

    playwright-cli install --skills
  3. 3

    Open a browser and navigate to a page

    playwright-cli open https://playwright.dev --headed

Things to know

  • Requires Node.js 18 or newer.
  • Designed mainly for coding agents; it is not a general-purpose test runner.

In collections

Topics

FAQ

What is playwright-cli?
A command-line interface for Playwright browser automation, designed for coding agents to drive browsers through short shell commands and skills. playwright-cli exposes common Playwright browser actions as shell commands. Coding agents such as Claude Code or GitHub Copilot can open pages, click and fill elements, take screenshots, record user actions as Playwright code, and inspect selectors without loading large tool schemas into the model context. Developers can also run the same commands by hand to explore a site or debug a flow.
Is playwright-cli free to use? What license does it have?
playwright-cli is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is playwright-cli still maintained?
Actively maintained. The last commit to playwright-cli was on Nov 5, 2026.
What can I use playwright-cli for?
Letting a coding agent test a web app flow and capture screenshots of passing and failing steps. Debugging a page interactively by running commands by hand against a visible browser. Recording a user flow and converting it into Playwright test code. Inspecting selectors and element attributes while writing end-to-end tests.
How do I install playwright-cli?
Install the CLI globally with npm: npm install -g @playwright/cli@latest Install the agent skills: playwright-cli install --skills Open a browser and navigate to a page: playwright-cli open https://playwright.dev --headed
Where can I get playwright-cli?
The source code and installation instructions are on GitHub: https://github.com/microsoft/playwright-cli

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects