Skip to main content
Become AI-Ready

What is playwright-cli?

playwright-cli is how AI coding agents interact with a live browser. Click, navigate, capture locators, and extract everything needed to build UI tests. All from the terminal.

Abstract tech visualization
~/project$playwright-cli open https://demo.playwright.dev/todomvc
Page URL: https://demo.playwright.dev/todomvc · Title: TodoMVC
~/project$playwright-cli snapshot
- textbox "What needs to be done?" [ref=e5]
- list "todos" [ref=e8] (0 items)
~/project$playwright-cli fill e5 "Write E2E tests" --submit
page.getByPlaceholder('What needs to be done?').fill('Write E2E tests')

Works with every AI agent & LLM

Bring your own agent. playwright-cli is the browser layer.

AI Coding Agents

Claude CodeClaude Code
GitHub CopilotGitHub Copilot
CursorCursor
VS CodeVS Code
CodexCodex
OCOpencode
Claude CodeClaude Code
GitHub CopilotGitHub Copilot
CursorCursor
VS CodeVS Code
CodexCodex
OCOpencode

All Major LLMs

ClaudeClaude
ChatGPTChatGPT
GeminiGemini
Grok / xAIGrok / xAI
DeepSeekDeepSeek
Meta LlamaMeta Llama
ClaudeClaude
ChatGPTChatGPT
GeminiGemini
Grok / xAIGrok / xAI
DeepSeekDeepSeek
Meta LlamaMeta Llama

Core Capabilities

Agent-Native Browser Control

Point your AI coding agent at any URL, and it instantly converts the page into structured, machine-readable data. Every button, input, and link gets a stable locator, so your agent can click, fill forms, navigate, take screenshots, and extract data autonomously while you supervise.

$ playwright-cli open https://app.example.com
$ playwright-cli snapshot
- textbox "Email" [ref=e7]
- button "Sign In" [ref=e12]
$ playwright-cli fill e7 "user@example.com"
$ playwright-cli click e12
✓ Navigated → /dashboard

Language & Framework Agnostic

playwright-cli works with the stack you already use. Your agent explores the live app through playwright-cli, captures locators and page behavior, and then writes tests in your preferred language and framework. Playwright, Selenium, Cypress, or anything else. Your stack stays the same.

# Agent explores with playwright-cli…
$ playwright-cli snapshot
- button "Add to cart" [ref=e21]
# …then writes tests in your stack
// Playwright (TypeScript)
await page.getByRole('button', { name: 'Add to cart' }).click();
# Cypress
cy.contains('button', 'Add to cart').click()
# Selenium (Python)
driver.find_element(By.XPATH, "//button[text()='Add to cart']").click()

Up and Running in 3 Steps

No config files, no server to run, no MCP setup. Install globally, add skills, and tell your agent where to find them. That's it.

  1. 1

    Install the CLI

    Install playwright-cli globally. One command, works with Node.js 18+.

  2. 2

    Install Skills

    Skills are markdown files your coding agent reads at the start of every task. They describe every available playwright-cli command so your agent knows how to use it without you having to explain it each time.

  3. 3

    Update your AGENTS.md

    AGENTS.md is the file your coding agent reads to understand your project. This is the most common source of confusion for new users:

    • Playwright— the test framework you write tests in
    • Playwright MCP— the original agentic browser tool
    • playwright-cli— successor to Playwright MCP. Faster, more reliable, more secure. Use this one.
# Step 1 — install globally
$ npm install -g @playwright/cli@latest
# Step 2 — install Skills into your repo
$ playwright-cli install --skills
.agents/skills/playwright-cli/SKILL.md added
# Step 3 — add to AGENTS.md
Use playwright-cli for all browser control.
Do NOT use Playwright MCP or npx playwright for agent tasks.

How It Works

01

Open

Start a browser session. Headless by default, --headed if you want to watch.

$playwright-cli open https://app.example.com
02

Snapshot

Capture the accessibility tree. Every element gets a stable ref like e12. The agent reads this as plain text.

$playwright-cli snapshot
- button "Submit" [ref=e12]
- textbox "Email" [ref=e7]
03

Act

Click, fill, navigate using refs. Every command outputs the equivalent Playwright locator.

$playwright-cli fill e7 "user@example.com"
$playwright-cli click e12
✓ getByRole('button', { name: 'Submit' })

Built For Test Engineers

If you write test automation, know a programming language, and work alongside AI Coding Agents... playwright-cli is the best tool you can add to your stack.

QA Engineers

QA Automation Engineers

SDETs