You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Javadz 5cb0b892aa
docs: fixed API reference URL (#14175)
12 hours ago
.devcontainer chore: fixed devcontainer Docker usage (#3898) 2 years ago
.github test: add more chromium-tip-of-tree bots (#14120) 4 days ago
browser_patches browser(webkit): clear extra http headers on successive calls (#14152) 3 days ago
docs docs: fix small typo in 'Migrating from Protractor' (#14178) 12 hours ago
examples Revert "chore: use plugins for component testing again (#13977)" (#13998) 1 week ago
packages fix(test runner): do not run automatic fixtures for beforeAll hooks (#14104) 3 days ago
tests fix(test runner): do not run automatic fixtures for beforeAll hooks (#14104) 3 days ago
utils fix(chromium): work around about:blank issue on Chromium (#14068) 6 days ago
.editorconfig Initial commit 3 years ago
.eslintignore feat(ct): only rebuild when necessary (#14026) 7 days ago
.eslintrc.js chore: always import type (#13365) 1 month ago
.gitattributes chore: lang hint for GitHub 5 months ago
.gitignore feat(ct): only rebuild when necessary (#14026) 7 days ago Revert "chore: rework the crlf in md fix" 1 year ago devops: fix headlessness reporting to flakiness dashboard (#14069) 6 days ago
LICENSE chore(license): use Apache 2.0 (#389) 2 years ago
NOTICE chore(license): add NOTICE (#309) 2 years ago docs: fixed API reference URL (#14175) 12 hours ago Revert "chore: rework the crlf in md fix" 1 year ago
babel.config.json chore: don't include babel compiled files in webpack bundles (#9491) 7 months ago
package-lock.json chore: cut v1.22.0 (#14098) 4 days ago
package.json chore: cut v1.22.0 (#14098) 4 days ago
tsconfig.json chore: vite all frameworks (#13780) 3 weeks ago

🎭 Playwright

npm version Chromium version Firefox version WebKit version

Documentation | API reference

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Linux macOS Windows
Chromium 102.0.5005.40
WebKit 15.4
Firefox 99.0.1

Headless execution is supported for all the browsers on all platforms. Check out system requirements for details.

Looking for Playwright for Python, .NET, or Java?


Playwright has its own test runner for end-to-end tests, we call it Playwright Test.

Using init command

The easiest way to get started with Playwright Test is to run the init command.

# Run from your project's root directory
npm init playwright@latest
# Or create a new project
npm init playwright@latest new-project

This will create a configuration file, optionally add examples, a GitHub Action workflow and a first test example.spec.ts. You can now jump directly to writing assertions section.


Add dependency and install browsers.

npm i -D @playwright/test
# install supported browsers
npx playwright install

You can optionally install only selected browsers, see install browsers for more details. Or you can install no browsers at all and use existing browser channels.


Resilient • No flaky tests

Auto-wait. Playwright waits for elements to be actionable prior to performing actions. It also has rich set of introspection events. The combination of the two eliminate the need for artificial timeouts - primary cause of flaky tests.

Web-first assertions. Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met.

Tracing. Configure test retry strategy, capture execution trace, videos, screenshots to eliminate flakes.

No trade-offs • No limits

Browsers run web content belonging to different origins in different processes. Playwright is aligned with the modern browsers architecture and runs tests out-of-process. This makes Playwright free of the typical in-process test runner limitations.

Multiple everything. Test scenarios that span multiple tabs, multiple origins and multiple users. Create scenarios with different contexts for different users and run them against your server, all in one test.

Trusted events. Hover elements, interact with dynamic controls, produce trusted events. Playwright uses real browser input pipeline indistinguishable from the real user.

Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow entering frames seamlessly.

Full isolation • Fast execution

Browser contexts. Playwright creates a browser context for each test. Browser context is equivalent to a brand new browser profile. This delivers full test isolation with zero overhead. Creating a new browser context only takes a handful of milliseconds.

Log in once. Save the authentication state of the context and reuse it in all the tests. This bypasses repetitive log-in operations in each test, yet delivers full isolation of independent tests.

Powerful Tooling

Codegen. Generate tests by recording your actions. Save them into any language.

Playwright inspector. Inspect page, generate selectors, step through the test execution, see click points, explore execution logs.

Trace Viewer. Capture all the information to investigate the test failure. Playwright trace contains test execution screencast, live DOM snapshots, action explorer, test source and many more.

Looking for Playwright for TypeScript, JavaScript, Python, .NET, or Java?


To learn how to run these Playwright Test examples, check out our getting started docs.

Page screenshot

This code snippet navigates to and saves a screenshot.

import { test } from '@playwright/test';

test('Page Screenshot', async ({ page }) => {
  await page.goto('');
  await page.screenshot({ path: `example.png` });

Mobile and geolocation

This snippet emulates Mobile Safari on a device at a given geolocation, navigates to, performs action and takes a screenshot.

import { test, devices } from '@playwright/test';

  ...devices['iPhone 13 Pro'],
  locale: 'en-US',
  geolocation: { longitude: 12.492507, latitude: 41.889938 },
  permissions: ['geolocation'],

test('Mobile and geolocation', async ({ page }) => {
  await page.goto('');
  await page.locator('text="Your location"').click();
  await page.waitForRequest(/.*preview\/pwa/);
  await page.screenshot({ path: 'colosseum-iphone.png' });

Evaluate in browser context

This code snippet navigates to, and executes a script in the page context.

import { test } from '@playwright/test';

test('Evaluate in browser context', async ({ page }) => {
  await page.goto('');
  const dimensions = await page.evaluate(() => {
    return {
      width: document.documentElement.clientWidth,
      height: document.documentElement.clientHeight,
      deviceScaleFactor: window.devicePixelRatio

Intercept network requests

This code snippet sets up request routing for a page to log all network requests.

import { test } from '@playwright/test';

test('Intercept network requests', async ({ page }) => {
  // Log and continue all network requests
  await page.route('**', route => {
  await page.goto('');