Playwright: browser automation and testing in one API
2 min readDeveloper Tools · Tools · Guides
microsoft/playwright is a framework for web testing and browser automation. One API controls Chromium, Firefox and WebKit, and a built-in test runner handles the rest of end-to-end testing. It is open source under Apache 2.0, free to use, and it has become the default recommendation when someone asks what to use instead of Selenium or Cypress.
What it actually is
- A library that launches real browsers and drives them out-of-process, which avoids the limits of in-page test runners.
- Playwright Test, its own runner, with parallel execution, retries, sharding, snapshots and fixtures.
- Bindings for JavaScript and TypeScript, plus Python, .NET and Java. The JavaScript tooling is the most complete.
- Auto-waiting: actions wait until an element is ready, which removes most of the manual sleeps that make tests flaky.
- Network interception, device emulation and a trace viewer with step-by-step replay, screenshots and videos.
It can also run headless on all supported platforms, and it can use branded browsers like Chrome and Edge already on the machine.
A minimal setup
npm init playwright@latest
# or add it to an existing project
npm i -D @playwright/test
npx playwright install # downloads the browsersimport { test, expect } from '@playwright/test';
test('home page has the right title', async ({ page }) => {
await page.goto('https://example.com/');
await expect(page).toHaveTitle(/Example/);
await page.getByRole('link', { name: 'More information' }).click();
});Run it with npx playwright test. When something fails, npx playwright show-report opens the report, and traces let you step through exactly what the browser did.
Why people choose it
- Real cross-browser coverage, including WebKit, from one test file.
- Locators based on roles and text, which survive redesigns better than CSS selectors.
- Parallel by default, so CI times stay reasonable as the suite grows.
- It is also used for scraping, PDF generation and screenshots, and Microsoft maintains an MCP server for letting AI agents drive a browser.
Where it bites
- Browser downloads:
playwright installpulls browser binaries. Cache them in CI or your builds will be slow. - WebKit is not Safari. It is the engine, on your platform, not a guarantee of Safari behaviour on iOS.
- Flakiness has not gone away. Auto-waiting helps, but tests that depend on timing, shared data or real third-party sites will still fail randomly. Mock what you do not own.
- Selector discipline: prefer role and test-id locators. Long CSS chains are the usual cause of brittle suites.
- Non-JavaScript languages trail the JavaScript API on features and docs.
- Cloud testing is separate. The framework is free, and hosted browser grids are billed products.
Who it is for
- Teams who want end-to-end tests that run the same on a laptop and in CI.
- Developers automating browser tasks, from screenshots to form filling.
- Anyone moving off a slower or flakier setup.
- Not for unit testing logic. Use a unit test runner for that and keep Playwright for flows.
Verdict
Playwright is boring in the best sense: it does what it says, and the debugging tools are better than the competition. Start with three tests for your three most important user flows, then grow from there. Repository: github.com/microsoft/playwright

Written by
Shihab Hossain — Full-Stack Developer
I build thoughtful digital products from Bangladesh — fast web experiences with Next.js, Android apps with Flutter, and the infrastructure behind them.
Work with me