
Playwright browser testing starts with one command: npm init playwright@latest. That sets up a project where you write a test once and drive Chromium, Firefox and WebKit through the same API.
One note before we start. This is a guide, not a hands-on review. We built it from the GitHub repository, the README, the v1.65.1 release notes and the official site at playwright.dev. We haven’t run Playwright ourselves. Treat the steps below as the project’s documented path, not our test results.
What is Playwright, in plain words?
The repo describes Playwright as a framework for web testing and automation. It lets you test Chromium, Firefox and WebKit with a single API. An API (application programming interface) is just one consistent set of commands.
In practice, your code opens a browser, loads pages, clicks things and checks what shows up. The README splits the project into five entry points:
- Playwright Test for end-to-end testing
- Playwright CLI for coding agents
- Playwright MCP for AI agents
- Playwright Library for browser automation scripts
- VS Code extension for test authoring and debugging
This tutorial sticks to Playwright Test. It’s the path for developers and QA testers who want end-to-end tests. End-to-end means testing the app the way a user would, through the browser.
Quick facts: licence, stars and last update
| Item | What the notes say |
|---|---|
| Licence | Apache-2.0 |
| Main language | TypeScript |
| Stars / forks | 100,895 / 6,955 |
| Created | November 15, 2019 |
| Latest release | v1.65.1, November 13, 2026 |
| Last repository activity | November 23, 2026 |
The project lives in Microsoft’s GitHub organization. Its homepage is playwright.dev.
How to install Playwright Test
The README’s recommended route is a single command. Run it in an empty folder or in your existing project:
npm init playwright@latest
Prefer to add it by hand? The README gives this alternative:
npm i -D @playwright/test
npx playwright install
The second line downloads the browsers Playwright uses. Our notes don’t say how big that download is.
Which platforms does it run on?
The README text we have doesn’t list supported operating systems. Every install example in it uses npm, so you’ll need npm available on your machine. Check the installation docs on playwright.dev for OS requirements before you roll it out.
Write and run your first test
Here is the README’s sample file. It has two tests. The first checks the page title on the Playwright homepage. The second clicks the "Get started" link and checks for an "Installation" heading.
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});
test('get started link', async ({ page }) => {
await page.goto('https://playwright.dev/');
await page.getByRole('link', { name: 'Get started' }).click();
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
});
Run everything with:
npx playwright test
According to the README, tests run in parallel across all configured browsers. They run in headless mode by default, which means no browser window pops up. Each test also gets a fresh browser context, which the README describes as full isolation with near-zero overhead.
Why the test doesn’t need sleep calls
The README says there are no artificial timeouts. Playwright waits for elements to be actionable, and assertions retry until their conditions are met. That’s the auto-waiting feature, and it’s why the sample test has no manual pauses.
The locators in the sample also describe elements the way users see them. The README lists these:
page.getByRole('button', { name: 'Submit' })
page.getByLabel('Email')
page.getByPlaceholder('Search...')
page.getByTestId('login-form')
Open a trace when a test fails
Tracing is the feature to turn on early. The README says Playwright can capture execution traces, screenshots and videos on failure. The Trace Viewer lets you inspect every action, DOM snapshot, network request and console message.
To record a trace when a test is retried, the README’s config looks like this:
// playwright.config.ts
export default defineConfig({
use: {
trace: 'on-first-retry',
},
});
Then open a saved trace file:
npx playwright show-trace trace.zip
That’s the full loop: install, write, run, inspect. Break one assertion on purpose and try the viewer. It’s the quickest way to see whether the tool fits how you debug.
Three things to try next
1. Reuse a login across tests
Log in once, save the state, and load it in other tests. The README’s snippets:
// Save state after login
await page.context().storageState({ path: 'auth.json' });
// Reuse in other tests
test.use({ storageState: 'auth.json' });
2. Script a screenshot or PDF without a test runner
The README pitches the library for web scraping, PDF generation and screenshot capture. Install it with npm i playwright. Its screenshot example looks like this:
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://playwright.dev/');
await page.screenshot({ path: 'screenshot.png' });
await browser.close();
The README shows the code but not how to execute it. The library documentation covers that.
3. Emulate a phone
The README also shows device emulation. This snippet launches Chromium with the iPhone 15 profile:
import { chromium, devices } from 'playwright';
const browser = await chromium.launch();
const context = await browser.newContext(devices['iPhone 15']);
const page = await context.newPage();
await page.goto('https://playwright.dev/');
await page.screenshot({ path: 'mobile.png' });
await browser.close();
The AI-agent parts, briefly
Playwright CLI (npm i -g @playwright/cli@latest) and Playwright MCP (npx @playwright/mcp@latest) target AI tools. The README says the CLI is built for coding agents such as Claude Code and Copilot. It describes MCP as giving AI agents browser control through structured accessibility snapshots, and it links to modelcontextprotocol.io for the protocol itself.
The README also says the CLI is more token-efficient than MCP. That’s the project’s own claim, and we haven’t verified it. If you don’t use AI coding tools, you can skip both.
Limitations and who should skip it
- It’s code-first. The README describes no point-and-click test builder. The VS Code extension helps with authoring and debugging, but you’ll still write code.
- The README is all npm and TypeScript. Every install command and sample in our notes uses npm, and the samples are TypeScript. If your team works in another language, check the official docs before you assume the same experience.
- Releases can ship regressions. The v1.65.1 notes list two bug fixes. One is a decorated class with a static field failing to load in 1.65 when
useDefineForClassFieldsis false. The other is test locations being one column off under Bun 1.4.4 and later. Both are narrow cases. Our take: pin your version and skim release notes before upgrading. - Browser version numbers differ between sources. The release notes list Chromium 159.0.8154.6. The README badge shows 159.0.8154.13. Firefox 159.0 and WebKit 27.2 match in both.
- Browsers are managed by Playwright. The install step downloads them, but our notes don’t cover download size or how they compare with your everyday browsers.
You can probably skip Playwright if you only need to click through one page by hand. The same goes if nobody on your team wants to write test code. The notes don’t mention competing tools, so we won’t claim Playwright beats any of them.
Playwright browser testing FAQ
Is Playwright free?
Yes. The repository lists the Apache-2.0 licence, and the install commands above pull the packages through npm.
Which browsers does Playwright support?
Chromium, Firefox and WebKit, according to the README and the repository description.
Can I use Playwright without the test runner?
Yes. The README describes the Playwright Library for browser scripts that don’t need a test runner. Examples include screenshots, PDFs, mobile emulation and network interception.
Does Playwright run headless by default?
The README says tests run in headless mode by default.
Where to start
Make a scratch folder and run npm init playwright@latest. Then run npx playwright test and turn on trace: 'on-first-retry'. Break one assertion on purpose and open the trace. If that workflow feels right, read the testing docs and pin your version before sharing the setup with a team.
Repository: github.com/microsoft/playwright. Official website: playwright.dev.
Image: jamesmarkosborne / Pixabay
Sources
- microsoft/playwright on GitHub (github.com)
- Release v1.65.1 (github.com)
- Fast and reliable end-to-end testing for modern web apps | Playwright (official site) (playwright.dev)
This article was researched and drafted with AI assistance and reviewed against the linked sources by the Nexonic editorial team.
Join the conversation