Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Playwright Core

Headless browser automation library for cross-browser testing and web scraping.

Scraping, browsers and parsingNPM

GitHubWebsite

1. License

License from npm.

github.com/microsoft/playwright

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Playwright Core does

One browser engine for Chromium, Firefox and WebKit with several entry points: a test runner, a scripting library, and two agent interfaces (a CLI and an MCP server) where agents act on refs from accessibility snapshots instead of on screenshots.

Playwright Core popularity

86 / 100
Gid Score, #37 overall
203M
downloads a week, npm
101K
GitHub stars
80
agent projects use it
Playwright Core: downloads per weeknpm, playwright-core 202,759,253
Playwright Core: GitHub starsmicrosoft/playwright 100,939

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Playwright Core is used

  • Playwright Core is a dependency in 80 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.6% of the 4,867 JavaScript/TypeScript ones), #3 of 141 in scraping, browsers and parsing.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 335; those are left out of every share on this page.
  • The most used alternative in our scan is Puppeteer (86 projects).
  • Projects that use it most often also use Vitest (73.8%), tsx (60.0%), Zod (72.5%).
  • It is more common in projects set up for OpenClaw (9.6%) than for Cursor (0.4%).

By coding agent

67 projects, 2.0%
36 projects, 1.2%
32 projects, 9.6%
23 projects, 4.9%
10 projects, 0.4%
6 projects, 1.3%
5 projects, 1.5%

Often used with

In 73.8% of its projects
In 60.0% of its projects
In 72.5% of its projects
In 52.5% of its projects
In 51.2% of its projects
In 48.8% of its projects
In 48.8% of its projects
In 47.5% of its projects

Playwright Core in practice

Strengths

Agents click refs, not pixels

The MCP server gives the model an accessibility tree in which each element has a ref. The next tool call then targets that ref. The docs say this needs no vision model and no coordinate guessing.

A CLI sized for coding agents

Playwright CLI is aimed at Claude Code, Copilot and similar agents. The maintainers write that it is "more token-efficient than MCP" because commands do not load large tool schemas or accessibility trees into the model context.

Waiting is built in

Actions wait until elements are actionable, and assertions retry until their conditions are met. The docs present this as the replacement for hand-written timeouts.

Scripts without a test runner

The <code>playwright</code> library covers plain automation scripts. The README shows examples for screenshots, A4 PDFs, iPhone emulation and blocking image requests with <code>page.route</code>.

Watch out for

Sources describe Playwright, not playwright-core

The README tells you to install <code>playwright</code>, <code>@playwright/test</code>, <code>@playwright/cli</code> or <code>@playwright/mcp</code>. None of these pages explains what <code>playwright-core</code> contains by itself or when to choose it.

MCP costs more context than the CLI

The docs' own comparison table rates the MCP server higher on token cost, because tool schemas and snapshots sit in the model context. The CLI is rated lower.

MCP opens a visible browser by default

The MCP server starts headed. The CLI defaults to headless. Expect a browser window to appear unless you change the setting.

Take a screenshot with the library

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://playwright.dev/');
await page.screenshot({ path: 'screenshot.png' });
await browser.close();

More about Playwright Core

Agent Skills for it
  • playwright-core: Battle-tested Playwright patterns for E2E, API, component, visual, accessibility, and security testing. Covers locators, assertions, fixture

See all

Head to head
Packages around it
  • vitest: test runner
  • tsx: TypeScript runner
  • dotenv: env file loader
  • zod: schema validation
  • undici: HTTP client
  • ws: WebSocket library
More in Scraping, browsers and parsing

Alternatives

Playwright Core This page

Apache-2.0Gid 86203M/wk

Puppeteer

Headless Chrome/Chromium automation for scraping, testing and screenshot generation.

Apache-2.0Gid 8016M/wk

Puppeteer Core

Headless Chrome/Chromium control library for automation and testing.

Apache-2.0Gid 8035.1M/wk

Compare Playwright Core with another tool

Get started

Install it.

npm install playwright-core

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Playwright
- Locate elements with `getByRole`, `getByLabel`, `getByPlaceholder` or `getByTestId`, not brittle CSS paths.
- Do not add manual sleeps or timeouts. Rely on auto-wait and web-first assertions such as `expect(page).toHaveTitle(...)`.
- Save login state once with `page.context().storageState({ path: 'auth.json' })` and reuse it with `test.use({ storageState: 'auth.json' })`.
- Set `trace: 'on-first-retry'` in `playwright.config.ts` and open failures with `npx playwright show-trace trace.zip`.
- In a large codebase, drive the browser with `playwright-cli` rather than MCP. It has lower token cost and is headless by default.
- When using the CLI or MCP, act on element refs (e.g. `e21`) from the latest snapshot, not on screen coordinates.
- In library scripts, always call `await browser.close()` when done.