Playwright is a cross-browser web automation and testing framework developed by Microsoft. It provides a single, unified API for controlling Chromium, Firefox, and WebKit browsers, enabling end-to-end test automation, scripted browser interactions, network interception, component testing, and developer tooling.
The project is published at https://github.com/microsoft/playwright and distributed as a set of npm packages. The current development version is 1.59.0-next.
Key properties of the framework:
mcr.microsoft.com/playwright.@playwright/test adds a full test runner with fixtures, assertions, sharding, and reporting.For a deeper view of how the layers communicate internally, see the Core Architecture page. For the package dependency graph, see Package Structure.
| Capability | Description | Primary API / Package |
|---|---|---|
| Browser automation | Launch/connect to browsers, navigate pages, interact with elements | playwright-core, playwright |
| End-to-end testing | Test runner with fixtures, parallelism, sharding, retries | @playwright/test |
| Network interception | Intercept, modify, mock HTTP and WebSocket traffic | Page.route, BrowserContext.route, Page.routeWebSocket |
| API testing | Send HTTP requests outside the browser with cookie sharing | APIRequestContext |
| Component testing | Mount and test UI components in isolation via Vite | @playwright/experimental-ct-* |
| Code generation | Record user actions and generate test code | playwright codegen |
| Trace recording | Capture full execution traces (DOM snapshots, network, console) | BrowserContext.tracing, playwright show-trace |
| UI Mode | Interactive test development with live trace display | playwright test --ui |
| MCP server | Browser automation server for AI agent integrations | packages/playwright/lib/mcp/ |
Playwright's JavaScript/TypeScript implementation lives in this repository. Bindings for other languages are maintained in separate repositories but share the same browser protocol layer.
| Language | Package / Module | Notes |
|---|---|---|
| JavaScript / TypeScript | playwright, @playwright/test (npm) | Primary implementation; this repository |
| Python | playwright (PyPI) | Separate repo; sync and async APIs |
| Java | com.microsoft.playwright (Maven) | Separate repo |
| C# (.NET) | Microsoft.Playwright (NuGet) | Separate repo; supports NUnit, MSTest, xUnit |
API changes in this repository are tracked across language bindings via the pr_check_client_side_changes GitHub Actions workflow (see CI/CD and Release Management).
Playwright is organized as an npm workspace monorepo. The workspace is declared in package.json51-52 and contains all packages under packages/.
Sources: package.json51-52 packages/playwright-core/package.json packages/playwright/package.json packages/playwright-test/package.json packages/playwright-ct-core/package.json
| Package | npm Name | Key Exports | Purpose |
|---|---|---|---|
packages/playwright-core | playwright-core | index.js, lib/server/index.js, lib/cli/program.js, lib/mcpBundle.js | All browser automation primitives; no browser binaries included |
packages/playwright | playwright | index.js, lib/transform/*, lib/mcp/*, lib/program.js | Wraps playwright-core; adds test transforms, MCP server |
packages/playwright-test | @playwright/test | index.js, cli.js, reporter.js | Full test runner; depends on playwright |
packages/playwright-chromium | playwright-chromium | index.js | playwright-core + Chromium binaries only |
packages/playwright-firefox | playwright-firefox | index.js | playwright-core + Firefox binaries only |
packages/playwright-webkit | playwright-webkit | index.js | playwright-core + WebKit binaries only |
packages/playwright-ct-core | @playwright/experimental-ct-core | index.js, lib/mount.js, lib/program.js | Component testing base; depends on vite@^6.4.1 |
packages/playwright-ct-react | @playwright/experimental-ct-react | index.js, register.mjs, hooks.mjs | React adapter for ct-core |
packages/playwright-ct-vue | @playwright/experimental-ct-vue | index.js, register.mjs, hooks.mjs | Vue adapter for ct-core |
packages/playwright-ct-svelte | @playwright/experimental-ct-svelte | index.js, register.mjs, hooks.mjs | Svelte adapter for ct-core |
Sources: packages/playwright-core/package.json1-43 packages/playwright/package.json1-73 packages/playwright-test/package.json1-35 packages/playwright-ct-core/package.json1-33 packages/playwright-ct-react/package.json1-39 packages/playwright-ct-vue/package.json1-39
Playwright targets three browser engines. Versions are centrally declared in browsers.json and synchronized automatically on each release.
| Browser | Engine | Distribution | Notes |
|---|---|---|---|
| Chromium | Blink | playwright-chromium; bundled in playwright | Uses Chrome for Testing builds (v1.57+). Headed: chrome, headless: chrome-headless-shell. Arm64 Linux uses upstream Chromium. |
| Firefox | Gecko | playwright-firefox; bundled in playwright | Patched via the Juggler XPCOM extension to expose automation APIs. |
| WebKit | WebCore | playwright-webkit; bundled in playwright | Patched to expose the WebKit Inspector Protocol. |
Branded browsers (Google Chrome, Microsoft Edge) can also be targeted via the channel option in launch configuration.
Browser binary versions, revision numbers, and installByDefault flags are all declared in packages/playwright-core/browsers.json. Device emulation profiles (viewport, user agent, deviceScaleFactor, hasTouch) are in packages/playwright-core/src/server/deviceDescriptorsSource.json.
For the full browser management system including the Registry class, CDN download mechanism, and patching details, see Browser Management.
Sources: packages/playwright-core/package.json1-43 docs/src/browsers.md1-50
Playwright's architecture is layered. Users interact with the public API; internally, commands travel through a channel protocol to a server process that communicates with the browser over its native protocol.
Sources: packages/playwright-core/package.json17-38
For detailed documentation of each layer see:
browsers.json, Registry class, download systemprotocol.yml, channels.ts, validator.tsThe following diagram maps each major subsystem to the wiki pages and source directories where it is documented and implemented.
Sources: package.json18-49 packages/playwright-core/package.json17-38 packages/playwright/package.json14-58 packages/playwright-test/package.json17-26
@playwright/test exports three entry points (packages/playwright-test/package.json17-26):
. (index.js): Test fixtures, test, expect, built-in Playwright fixtures (page, context, browser, request)./cli (cli.js): CLI entry for npx playwright test./reporter (reporter.js): ReporterV2 interface for custom reportersDependency chain: @playwright/test → playwright → playwright-core.
@playwright/experimental-ct-core (packages/playwright-ct-core/package.json1-33) is the shared base for all component testing packages. It depends on vite@^6.4.1 to serve components in a test harness. Framework-specific packages add a Vite plugin and re-export the mounting API:
| Package | Vite Plugin | Framework |
|---|---|---|
@playwright/experimental-ct-react | @vitejs/plugin-react | React 18+ |
@playwright/experimental-ct-react17 | @vitejs/plugin-react | React 17 |
@playwright/experimental-ct-vue | @vitejs/plugin-vue | Vue 3 |
@playwright/experimental-ct-svelte | @sveltejs/vite-plugin-svelte | Svelte |
Sources: packages/playwright-ct-core/package.json1-33 packages/playwright-ct-react/package.json1-39 packages/playwright-ct-vue/package.json1-39
The root package.json defines build, test, and development workflows.
| Script | Purpose | Implementation |
|---|---|---|
build | Compile TypeScript and bundle packages | node utils/build/build.js |
watch | Build with file watching and linting | node utils/build/build.js --watch --lint |
lint | Run ESLint, TypeScript, doc validation | eslint && tsc && doc && check-deps && generate_channels && generate_types |
test | Run library tests | playwright test --config=tests/library/playwright.config.ts |
ttest | Run test runner tests | Uses stable test runner from tests/playwright-test/stable-test-runner/ |
ctest / ftest / wtest | Browser-specific tests | Chromium / Firefox / WebKit projects |
roll | Update browser versions | node utils/roll_browser.js |
Sources: package.json18-49
Test execution scripts at package.json19-31:
ctest: Tests Chromium projects onlyftest: Tests Firefox projects onlywtest: Tests WebKit projects onlyatest: Android-specific testsetest: Electron-specific testsct: Component testing across all frameworksThe roll command at package.json43 updates browser versions by:
Sources: package.json18-49 utils/roll_browser.js (referenced but not provided)
Playwright version is defined centrally and propagated to all packages.
All packages share the same version number 1.59.0-next defined at:
The -next suffix indicates pre-release/development versions. Version synchronization is enforced by utils/workspace.js (referenced at package.json36).
Sources: package.json4 packages/playwright-core/package.json3 packages/playwright/package.json3 packages/playwright-test/package.json3
Playwright requires Node.js 18 or higher and includes specific dependencies for different features.
All packages specify "node": ">=18" in engines at:
Development Dependencies (from package.json54-106):
@babel/core@^7.28.3: JavaScript transformationtypescript@^5.9.2: TypeScript compilationvite@^6.4.1: Component testing bundleresbuild@^0.25.0: Fast JavaScript bundlingreact@^19.2.1, react-dom@^19.2.1: Component testingeslint@^9.34.0: Code linting@modelcontextprotocol/sdk@^1.26.0: MCP terminal systemProduction Dependencies:
playwright: Only dependency is [email protected] (packages/playwright/package.json67-69)@playwright/test: Only dependency is [email protected] (packages/playwright-test/package.json32-34)[email protected] for macOS file watching (packages/playwright/package.json70-72)Sources: package.json54-107 packages/playwright/package.json67-72 packages/playwright-test/package.json32-34
Refresh this wiki
This wiki was recently refreshed. Please wait 2 days to refresh again.