"npm init playwright. Five minutes later you're driving Chromium from a test."
The One-Command Bootstrap
npm init playwright@latest is unusual in how much it does. It installs @playwright/test, downloads the browser binaries (Chromium, Firefox, WebKit), creates playwright.config.ts, scaffolds an e2e/ directory with an example test, adds package.json scripts, and optionally generates a GitHub Actions workflow. The whole thing is interactive — answer a few prompts (TypeScript yes, GitHub Actions yes/no, default e2e/ directory), and you're shipped.
You can also install manually: npm install -D @playwright/test, then npx playwright install to download browsers. The init flow just consolidates the boilerplate.
Three Browsers, One Test
Playwright drives three browser engines:
- Chromium — the Chrome/Edge engine. Most market share, fastest to start, the project default.
- Firefox — Gecko engine. Catches behavior that differs from Chromium-only code.
- WebKit — Safari's engine. Critical if you care about Safari users or iOS Safari (the iOS browser, even "Chrome on iOS," is WebKit-only).
The same test runs against all three by default. You write the test once; Playwright runs it in three browsers and reports per-browser results. Cross-browser bugs are usually CSS-related or use a JavaScript API one engine implements differently — the kind of bug only a real browser test catches.
The Browser Binaries Are Not Trivial
The download is ~500 MB across all three browsers. Playwright caches them in ~/.cache/ms-playwright/ (Linux/macOS) or %USERPROFILE%\AppData\Local\ms-playwright (Windows). The version is pinned to the Playwright version — when you upgrade @playwright/test, you re-run npx playwright install to get matching binaries.
In CI, the binaries need to download fresh per environment unless you cache them. The official GitHub Actions setup uses a cache key on the Playwright version, so subsequent runs skip the download.
apt install browsers as a substitute. Playwright requires specific patched browser builds. Using system Chromium leads to subtle differences that cause flakes you can't reproduce. Always use npx playwright install.System Dependencies
Browsers need OS-level libraries (fonts, image codecs, accessibility frameworks). npx playwright install --with-deps installs both binaries AND the system dependencies. On macOS, the dependencies are usually pre-installed; on Linux (especially in CI containers), this flag is non-optional. On Windows, dependencies bundle with the browser.
The First Test
The example test scaffolded by init visits playwright.dev and asserts the title. That's enough to confirm the install works. Run it: npx playwright test. You'll see three results (one per browser), each in a few seconds.