microsoft /playwright
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
★ 99,731⑂ 6,833👁 616⑃ 21,853● 18,489▤ 169◈ 0
99,731
stars
+82
6,833
forks
616
watchers
21,853
prs
18,489
issues
169
releases
0
discussions
README
🎭 Playwright
Documentation | API reference
Playwright is a framework for web automation and testing. It drives Chromium, Firefox, and WebKit with a single API — in your tests, in your scripts, and as a tool for AI agents.
Get Started
Choose the path that fits your workflow:
| | Best for | Install |
|---|---|---|
| Playwright Test | End-to-end testing | npm init playwright@latest |
| Playwright CLI | Coding agents (Claude Code, Copilot) | npm i -g @playwright/cli@latest |
| Playwright MCP | AI agents and LLM-driven automation | npx @playwright/mcp@latest |
| Playwright Library | Browser automation scripts | npm i playwright |
| VS Code Extension | Test authoring and debugging in VS Code | Install from Marketplace |
---
Playwright Test
Playwright Test is a full-featured test runner built for end-to-end testing. It runs tests across Chromium, Firefox, and WebKit with full browser isolation, auto-waiting, and web-first assertions.
Install
bash
npm init playwright@latest
Or add manually:
bash
npm i -D @playwright/test
npx playwright install
Write a test
TypeScript
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) = {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});
test('get started link', async ({ page }) = {
await page.goto('https://playwright.dev/');
await page.getByRole('link', { name: 'Get started' }).click();
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
});
Run tests
bash
npx playwright test
Tests run in parallel across all configured browsers, in headless mode by default. Each test gets a fresh browser context — full isolation with near-zero overhead.
Key capabilities
Auto-wait and web-first assertions. No artificial timeouts. Playwright waits for elements to be actionable, and assertions automatically retry until conditions are met.
Locators. Find elements with resilient locators that mirror how users see the page:
TypeScript
page.getByRole('button', { name: 'Submit' })
page.getByLabel('Email')
page.getByPlaceholder('Search...')
page.getByTestId('login-form')
Test isolation. Each test runs in its own browser context — equivalent to a fresh browser profile. Save authentication state once and reuse it across tests:
TypeScript
// Save state after login
await page.context().storageState({ path: 'auth.json' });
// Reuse in other tests
test.use({ storageState: 'auth.json' });
Tracing. Capture execution traces, screenshots, and videos on failure. Inspect every action, DOM snapshot, network request, and console message in the Trace Viewer:
TypeScript
// playwright.config.ts
export default defineConfig({
use: {
trace: 'on-first-retry',
},
});
bash
npx playwright show-trace trace.zip
Parallelism. Tests run in parallel by default across all configured browsers.
Full testing documentation
---
Playwright CLI
Playwright CLI is a command-line interface for browser automaTop issues
#1086[Feature] create context in fullscreen mode40 comments · 2020-02-24#37277[Feature]: Allow to configure the protocol (`juggler` or `webDriverBiDi`) when launching the browser32 comments · 2025-09-03#32577Current limitations blocking Playwright's WebDriver BiDi adoption29 comments · 2024-09-12#42687[Bug]: headersArray() splits single header values on commas on Firefox and WebKit, corrupting every HTTP-date header8 comments · 2026-09-12#43966[Feature]: Resolve Node.js subpath imports (package.json "imports") to TypeScript sources7 comments · 2026-11-06#43921[Feature]: Expose Advanced WebAuthn Virtual Authenticator Options in Cross-Browser Credentials API6 comments · 2026-11-05#43967[Regression]: Firefox page crashes on getByRole with a name when aria-labelledby is also read in the main world5 comments · 2026-11-06#43067[BUG] WebKit (Linux): Assertion error in WKPage._onTargetCreated on a cross-site redirect chain5 comments · 2026-10-02
Latest release
v1.65.0 v1.65.0 2026-11-05🥟 Run tests with Bun The test runner now runs under Bun. Bun transpiles your TypeScript test files itself, so Playwright does not use Babel or its compilation cache. Pass the --bun flag, because without it bunx playwright test runs on Node.js: bash bunx --bun playwright test Our CI runs the test runner tests under Bun 1.4.3 on Linux. Some features work differently under Bun: - There is no watch mode. UI mode does not run tests again when files change, and --only-changed does not follow imports. - Bun loads modules itself, so --tsconfig and the JSX options in tsconfig.json have
相关报道 (6)
noteテスト自動化を任された文系40代ITおじさん、Playwrightを入れて、お試しのテストを動かしてみた。……が、知らないうちに全部 ...2026-10-16Pasquale Pillitteri2026 年抓取互联网的 10 个 GitHub 仓库 (附真实星标)2026-06-30智源社区OpenClaw 背后核心框架 Pi:好的 Coding Agent 应该让用户来决定需要什么2026-03-18观察者网以我的亲身体验,谈谈如何正确理解“养虾”2026-03-17InfoQ.cn网易有道 LobsterAI 推出技能商店并支持 MCP 协议,打造更开放的智能体生态2026-03-06腾讯新闻给OpenClaw开天眼!解决了10个跨境电商网站爬虫难题2026-03-03
News & coverage (16)
Hacker NewsPlaywright: Automate Chromium, WebKit and Firefox▲ 383 · 140 comments · 2022-01-26Hacker NewsPlaywright Tools for MCP▲ 181 · 34 comments · 2025-03-26Hacker NewsPlaywright for .NET is now stable▲ 155 · 64 comments · 2021-06-10Hacker NewsPlaywright CLI – Open/inspect/emulate pages, generate screenshots, record users▲ 134 · 21 comments · 2020-09-18Hacker NewsPlaywright-test – cross-browser end-to-end test suite with Playwright▲ 101 · 26 comments · 2021-04-05Hacker NewsMicrosoft Playwright: Automate Chromium, WebKit and Firefox▲ 43 · 3 comments · 2020-01-23noteValidating APIs During Playwright Tests with Postman2026-10-27StreetInsider.comBest AI Testing Platform, Amikoo, Launches Workers to Automate End-to-End Playwright Tests for Every Pull Request2026-10-27learnPlaywright MCP server for Power Platform testing2026-04-17learnQuickstart: Set up continuous end-to-end testing with Playwright Workspaces2025-08-06