Skip to main content

Web Testing and Automation

Playwright enables reliable end-to-end testing for modern web applications. Test across Chromium, Firefox, and WebKit with a single API.

Playwright logo

Quick start

Get up and running with Playwright in minutes

1

Install Playwright

Install Playwright using npm, yarn, or pnpm. The installation includes browser binaries for Chromium, Firefox, and WebKit.
npm init playwright@latest
The init command will create a configuration file, add example tests, and optionally set up a GitHub Actions workflow.
2

Write your first test

Create a test file that navigates to a page and performs an action.
example.spec.ts
import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  
  // Expect a title "to contain" a substring.
  await expect(page).toHaveTitle(/Playwright/);
  
  // Click the get started link.
  await page.getByRole('link', { name: 'Get started' }).click();
  
  // Expects the URL to contain intro.
  await expect(page).toHaveURL(/.*intro/);
});
3

Run your tests

Execute tests using the Playwright Test runner. Tests run in parallel by default.
npx playwright test
Running 3 tests using 3 workers

  ✓  [chromium] › example.spec.ts:3:1 › basic test (2s)
  ✓  [firefox] › example.spec.ts:3:1 › basic test (2s)
  ✓  [webkit] › example.spec.ts:3:1 › basic test (2s)

3 passed (6s)
4

View test results

Open the HTML test report to see detailed results, screenshots, and traces.
npx playwright show-report
The report includes screenshots on failure, execution traces, and the ability to inspect each test step.

Key features

Everything you need for modern web testing

Cross-browser testing

Test across Chromium, Firefox, and WebKit with a single API. Run tests on Windows, Linux, and macOS.

Auto-waiting

Playwright automatically waits for elements to be actionable before performing actions, eliminating flaky tests.

Test isolation

Each test runs in a fresh browser context, providing full isolation with zero overhead.

Powerful tooling

Code generation, trace viewer, and inspector help you write and debug tests faster.

Network control

Intercept, mock, and modify network requests to test edge cases and failure scenarios.

Mobile emulation

Emulate mobile devices with custom viewports, user agents, and geolocation.

Ready to get started?

Install Playwright and write your first test in under 5 minutes.

Get Started