# Playwright Core — card for AI agents

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

Category: Scraping, browsers and parsing · npm package `playwright-core` · latest version 1.64.1 (checked 2026-11-01)
Install: `npm install playwright-core`
License: Apache-2.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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.

## Agent Skills for it
- playwright-core from zebbern/claude-code-guide: `npx skills add zebbern/claude-code-guide --skill playwright-core`

## What it is
- Playwright is Microsoft's framework for browser automation and testing. The README says it drives Chromium, Firefox and WebKit through one API, "in your tests, in your scripts, and as a tool for AI agents." The repository was created on 2019-11-15 and is Apache-2.0 licensed. The latest listed release is v1.64.1, published 2026-10-14. These sources cover the Playwright project as a whole. They do not describe the `playwright-core` package on its own.
- There are several ways in. Playwright Test is the end-to-end test runner, with auto-waiting, isolated browser contexts, tracing and parallel runs. The `playwright` library is for scripts with no test runner: scraping, PDFs and screenshots. For AI agents there are two options. Playwright CLI is a shell tool with a persistent browser daemon. Playwright MCP is a Model Context Protocol server. Both show the page to the agent as an accessibility tree with element refs such as `e5`.
- The project is for developers who write browser tests or automation scripts. It is also for people who want a coding agent to open, inspect and operate a real browser. Bindings exist for Python, .NET and Java as well as Node.

## Caveats
- Sources describe Playwright, not playwright-core: The README tells you to install `playwright`, `@playwright/test`, `@playwright/cli` or `@playwright/mcp`. None of these pages explains what `playwright-core` 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.
- Recent regressions in 1.64.0: v1.64.1 fixes two bugs. In one, Chromium 155+ aborted preflighted cross-origin redirects whenever any route was registered. In the other, `_electron.launch` lost a packaged app's first window.
- One MCP tool is named unsafe: The core MCP tool set includes `browser_run_code_unsafe`, which runs a Playwright code snippet. The tool's name itself carries the warning.

## Numbers (AgentGid data)
- Gid Score: 85.8 (#37 of all tools, 1 of 141 in its category)
- Used in 80 public projects set up for AI coding agents (1.3%)
- Downloads last week: 202,759,253 (as of 2026-11-24), +54.0% over 4 weeks
- GitHub stars: 100,939 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
Vitest 73.8%, tsx 60.0%, Zod 72.5%, ws 52.5%, undici 51.2%, Express 48.8%

## Checked alternatives (same job)
- Puppeteer: https://agentgid.com/tools/puppeteer/agent.md
- Puppeteer Core: https://agentgid.com/tools/puppeteer-core/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/playwright-core/
- Homepage: https://playwright.dev
- Repository: https://github.com/microsoft/playwright
- Source: https://github.com/microsoft/playwright#readme
- Source: https://github.com/microsoft/playwright
- Source: https://github.com/microsoft/playwright/releases
- Source: https://playwright.dev
- Source: https://playwright.dev/agent-cli/introduction
- Source: https://playwright.dev/mcp/introduction

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
