Skip to content

Install

System requirements

  • Node.js 22.x, 24.x, or 26.x
  • Windows 11+, macOS 14+, or a modern Linux distribution

Scaffold a new Playwright project

The recommended path is the init scaffolder. It creates playwright.config.ts, an example test, a GitHub Actions workflow (optional), and installs browser binaries.

bash
npm init playwright@latest

Or with yarn or pnpm:

bash
yarn create playwright
pnpm create playwright

The interactive installer asks:

  1. TypeScript or JavaScript?
  2. Where to put tests? (default: tests/)
  3. Add a GitHub Actions workflow? (optional)
  4. Install Playwright browsers? (yes -- required for first run)

Add to an existing project

bash
npm install --save-dev @playwright/test
npx playwright install

npx playwright install downloads Chromium, Firefox, and WebKit binaries into the local cache. To install only one browser:

bash
npx playwright install chromium

Template / starter

Running npm init playwright@latest scaffolds a complete starter. The generated files are:

playwright.config.ts      # configuration: browsers, base URL, retries, reporters
tests/
  example.spec.ts         # two working example tests
tests-examples/
  demo-todo-app.spec.ts   # full demo against a sample todo app

No separate downloadable template repo is needed; the scaffolder IS the official starter.

Verify the install

bash
npx playwright --version

Expected output (version number will vary):

Version 1.x.x