Home / Blog / What is Playwright?
What is Playwright?
Playwright is an open-source framework for testing web applications in a browser. It drives Chromium, Firefox and WebKit from one API, in TypeScript, Python, Java or .NET, and its runner has waiting, assertions, parallelism and tracing built in. It tests anything running in a browser. It does not test native mobile apps and it is not a load-testing tool.
Someone asking this is usually deciding one thing: whether Playwright covers what they need to test. That turns less on the feature list than on what the thing being tested is — a web application that runs in a browser, or an application people install from a store.
What is Playwright, exactly?
The documentation defines it in one sentence: "Playwright Test is an end-to-end test framework for modern web apps. It bundles test runner, assertions, isolation, parallelization and rich tooling." Microsoft publishes it on GitHub under the Apache License 2.0.
The package is two things, and readers trip over the split sooner or later. Playwright Library
drives browsers; Playwright Test is the runner built on top of it, and
npm init playwright@latest installs it. The library documentation states the division:
"Playwright Library provides unified APIs for launching and interacting with browsers, while
Playwright Test provides all this plus a fully managed end-to-end Test Runner and
experience."
The same page lists what the Library goes without: web-first assertions that retry, the configuration matrix that runs one test across several browsers, parallelisation, reporting, retries and tracing. Cleanup is manual there too — you close the context and the browser yourself. For end-to-end testing you want the runner.
Either way it drives three engines from one API: Chromium, Firefox and WebKit. That API ships in four official bindings — TypeScript and JavaScript through the Node.js package, then Python, Java and .NET. Firm86 delivers suites in all four.
Playwright downloads its own builds of those three browsers and drives them directly, rather than attaching to a copy of Chrome you installed. The consequences of that are worked through in how Playwright is built.
What is Playwright used for?
End-to-end tests of a web application are the main job. One suite runs against all three engines, with the browser matrix as a few lines of configuration.
Mobile web. A device descriptor emulates a phone by setting the user agent, the screen size, the viewport and the touch flag, with locale, timezone and geolocation on the same switch. Responsive layouts and touch behaviour are testable that way.
API calls alongside browser tests. The API testing guide frames this as testing your server API, preparing server-side state before the browser opens the page, and checking it afterwards. It is a request client in the same test file as the browser test, and it is not pitched as a replacement for a dedicated API tool.
Component tests. Playwright can mount a single component in a real browser and drive it the way it drives a page; in 1.62 that runs through stories and a gallery page.
Accessibility feedback. Role locators are built on ARIA roles and accessible names, so a test written with them fails when the accessible name disappears. The locators documentation is careful about the claim: role locators do not replace accessibility audits and conformance tests, they give early feedback against the ARIA guidelines.
Playwright now also ships tooling aimed at coding agents, including an MCP server and a command-line interface built for them, which is the subject of Playwright and AI test generation.
What is Playwright not for?
The framework has edges, and they are cheaper to learn now than in month three.
- Native mobile applications. Playwright drives browsers. If your product is something people install from an app store, its screens are not reachable from Playwright, and the tools for that job are Appium and the vendors' own SDKs — Firm86 sells neither. Stated more flatly than that it gets corrected, because Android support exists and the API reference is exact about it: "Playwright has experimental support for Android automation. This includes Chrome for Android and Android WebView." That is a browser and a web view running on a device over ADB, and it is not your app's native UI.
- Emulation is emulation. The installation page mentions "native mobile
emulation for Chrome (Android) and Mobile Safari", the emulation guide hands you
devices['iPhone 13'], and between them a lot of first-time readers conclude they have an iPhone in CI. A device descriptor sets the user agent, the screen size, the viewport and the touch flag, plus locale, timezone and geolocation if you ask. Your site then runs in a desktop engine wearing a phone's clothes: useful for responsive behaviour, and an emulated phone, not a phone. - Safari on a real iPhone. Playwright's WebKit is not the browser Apple ships. The browsers documentation says so: "Playwright doesn't work with the branded version of Safari since it relies on patches. Instead, you can test using the most recent WebKit build." The same page carries the other half: that build comes from the latest WebKit main branch, often ahead of what has reached Apple Safari, so it catches engine-level problems early. It will not catch what Apple's shipping browser does differently on Apple's hardware. A contract that names real iOS devices needs a device cloud.
- Load and performance at scale. Playwright measures one real browser doing one thing carefully; pointing a thousand of them at a server measures your CI budget. Load and performance work belongs to k6, JMeter and Gatling, and Firm86 does not sell a load-testing engagement.
- Internet Explorer, security testing and penetration testing. Playwright supports three engines and Internet Explorer is not among them. Security and penetration testing are a separate discipline with separate tools, and Firm86 does not do them.
Where each of these limits costs a team something, and where it costs nothing, is argued at length in the case for and against Playwright.
What does Playwright replace, and what does it not?
Adopting Playwright deletes some things from a toolchain and leaves others where they are.
| Goes away when you adopt Playwright | Stays exactly where it is |
|---|---|
| The driver binary and the version-matching that comes with it | Your unit tests, and the runner that runs them |
| The explicit-wait helper class | Appium, if you have a native app — Playwright does not drive one |
| A separate assertion library | k6, JMeter or Gatling, if you run load tests — Playwright is not one of them |
| Screenshot, video and trace tooling bolted on afterwards | A device cloud, if you need a real iPhone — an emulated device is not one |
| A Selenium Grid | Your CI system — Playwright runs inside it |
Playwright does not ship a Grid replacement, which is where that row gets misread. It installs its browsers next to the tests and takes concurrency from workers in the config file and from sharding the run across CI jobs, so the Grid's job becomes configuration and CI capacity. If your next question is the direct comparison, it is in what actually breaks when a Selenium suite moves.
What does it cost a team to run Playwright?
The licence costs nothing. The running has a bill, in two places.
The first is disk. Every machine that runs tests keeps its own copies of the browsers, in
%USERPROFILE%\AppData\Local\ms-playwright on Windows,
~/Library/Caches/ms-playwright on macOS and ~/.cache/ms-playwright on
Linux. The browsers documentation prints its own du -hs output for those folders:
281M for Chromium, 187M for Firefox, 180M for WebKit. The three add to 648M, so call it about
650MB per machine. Those figures move with every release; they are not a fixed specification.
The second is CI. The official image is
mcr.microsoft.com/playwright:v1.62.0-noble, which pins the browsers and their
operating-system dependencies to the Playwright version. The CI documentation's advice on caching
those binaries: "Caching browser binaries is not recommended, since the
amount of time it takes to restore the cache is comparable to the time it takes to download the
binaries." The same page adds that the operating-system dependencies cannot be cached at
all.
The other CI figure to know is the worker count. Playwright defaults it to the detected core count, and the CircleCI section of that page warns that raising it above what the machine has "will cause unnecessary timeouts and failures" — on a CircleCI medium executor the detected count is 2. A CI agent is smaller than the laptop the suite was written on.
We have not measured a total, so this page does not publish one. It depends on how many machines run the suite and what your CI provider charges for the minutes.
Which teams should not adopt Playwright?
A team whose product is an app people install from a store, and whose only web presence is a marketing site, would be buying a browser tool to test a marketing site. That can still be worth doing, and it is a smaller decision than the one they thought they were making.
If your one supported browser is Safari on real iOS hardware and the contract names the hardware, you need a device cloud before you need a framework.
Anyone who came looking for a load-testing tool is looking at the wrong kind of tool, and no Playwright release is going to change that.
A team with no continuous integration will not keep the suite. Tests that run on somebody's laptop when they remember rot at the same speed in every framework, and the first fix there is the pipeline.
On the other side of that list is a web application, a browser matrix you can name, a pipeline that already runs on every commit, and nobody with the time to write the specs. For that team the engagement is building an end-to-end Playwright suite.
A first Playwright test
One test, whole, as it would sit in a repository:
import { test, expect } from '@playwright/test';
test('adding a kettle puts it in the basket', async ({ page }) => {
await page.goto('https://example.com/products/kettle');
await page.getByRole('button', { name: 'Add to basket' }).click();
await expect(page.getByTestId('basket-count')).toHaveText('1');
});
Playwright 1.62 · TypeScript
There is no browser to launch and no driver to start in that test, because the
page fixture arrives ready. There is no explicit wait before the assertion, because
toHaveText re-fetches the element and re-checks it until it passes or the assertion
timeout is reached, five seconds by default. And there is no teardown, because the runner closes
what it opened.
The locator reads the way a person describes the page: the button labelled "Add to basket". For the same test with fixtures, configuration and a project layout under it, start at the Playwright tutorial.
Questions
Is Playwright free?
Yes. Playwright is published by Microsoft on GitHub under the Apache License 2.0, so there is no licence to buy and no seat to count. Running it has a bill. Every machine that runs tests keeps its own copy of the browsers, which the browsers documentation lists as 281M for Chromium, 187M for Firefox and 180M for WebKit, and the CI minutes those browsers spend are charged by whoever charges you for CI.
Can Playwright test mobile apps?
Mobile web, yes. Native apps, no. Playwright drives browsers, so a site opened on a phone is in scope, and a device descriptor emulates one by setting the user agent, the screen size, the viewport and the touch flag. Playwright does not reach the screens of an application someone installs from an app store. Android support exists and the API reference is exact about its scope: experimental, covering Chrome for Android and Android WebView, which is a browser and a web view running on a device rather than a native app UI. For native apps the tools are Appium and the vendors' own SDKs, and Firm86 sells neither.
Is Playwright better than Selenium?
It depends on what you already have. Playwright bundles the runner, the assertions, the parallelism and the tracing that a Selenium suite assembles from separate libraries, and it downloads and drives its own browser builds. Selenium 4 implements the W3C WebDriver standard, has a far longer history, and an enormous number of working suites are already written in it. Neither choice is a mistake, and a suite that runs green every morning is worth more than either framework.
Which languages does Playwright support?
Four official bindings: TypeScript and JavaScript through the Node.js package, Python, Java and .NET. The playwright.dev homepage lists them as TypeScript, Python, .NET and Java, and the API reference carries a door for each. The documentation's defaults, the samples in most guides and the bulk of the community material are TypeScript, which matters if your team will be reading other people's examples all year. Firm86 delivers a suite in all four bindings, so a Java team keeps writing Java.
Do you need to be able to code to use Playwright?
Yes. Playwright ships a generator that records a click-through in the browser and writes the test for you, and what comes out is source code that somebody has to read, review and change every time the page changes. A team with nobody who can read it has a suite nobody can fix in month four, and the usual ending is that the suite gets switched off.
Tell us what the application is
What it does, and which browsers it has to work in. From those we can talk about building the suite: the specs in your repository, the CI job that runs them, and a runbook for the team that inherits it.