
Unit tests tell you that a function returns the right value. They do not tell you that a customer can sign in, add a product to the cart and pay in Safari on a phone. That has to be tested in a real browser, and browser tests have a reputation for being slow and flaky: a button is not clickable yet, an animation is still running, and the test fails for reasons that have nothing to do with the code. Playwright is Microsoft's open-source answer to that problem.
This article explains what Playwright is, how it drives browsers, where it is used, when another tool fits better, and how it compares with Cypress and Selenium.
What is Playwright?
Playwright is an open-source framework for browser automation and E2E testing, developed by Microsoft and released under the Apache 2.0 licence. One API drives the three major browser engines: Chromium (Chrome and Edge), Firefox and WebKit (the engine behind Safari), on Linux, macOS and Windows, with or without a visible window. It is available for TypeScript and JavaScript, Python, .NET and Java.
Microsoft released Playwright on 31 January 2020. Engineers who had previously worked on Puppeteer, Google's Chrome automation library, were among its developers, and the project set out to address the limits of older tools: one browser only, unreliable waiting and weak isolation between tests. Playwright 1.0 followed in May 2020, and Playwright Test, the project's own test runner, was published later that year.
The scope has grown beyond testing. Playwright is also used for scripting and web scraping, and the project now ships an MCP server and a command-line interface that let AI agents control a browser.
How Playwright works
It drives the browser from outside. Your test runs as a normal program and sends commands to the browser. That is why one test can open several tabs, switch between different domains or run against three browser engines without changes.
It waits for elements automatically. Before clicking, typing or reading, Playwright checks that the element is visible, stable (not animating), enabled and not covered by another element. Assertions such as "this text is visible" retry until they pass or time out. Most of the hand-written sleep calls that make browser tests flaky are no longer needed.
Every test gets a fresh browser context. A browser context is the equivalent of a brand-new browser profile, with its own cookies and storage, created with near-zero overhead. Tests do not leak state into each other, and a signed-in session can be saved once and reused across tests.
Locators follow what the user sees. Instead of brittle CSS paths, tests find elements by role, label, placeholder, text or test id, for example getByRole('button', { name: 'Pay' }). A redesign that keeps the same visible button does not break the test.
Tests run in parallel. The test runner spreads tests across workers and browsers by default, and a large suite can be sharded across several CI machines.
Key features
- Cross-browser coverage: Chromium, Firefox and WebKit, headless or headed, on all three desktop operating systems.
- Auto-waiting and web-first assertions that retry until a condition is met.
- Test generator (codegen): click through the app and Playwright writes the test code and suggests locators.
- Trace Viewer: a timeline of each test with DOM snapshots, network requests, console logs and screenshots, so a failure in CI can be investigated without re-running it.
- Device emulation and network control: mobile viewports, geolocation and the ability to observe, block or mock network requests.
- VS Code extension for running, debugging and recording tests inside the editor.
- Playwright MCP and CLI for AI agents, which work from structured accessibility snapshots rather than screenshots.
Where Playwright is used
- E2E tests for web applications: sign-up, checkout, permissions and other flows that cross many pages and services.
- Regression suites in CI/CD, run on every pull request in pipelines such as GitHub Actions, often inside Docker images that ship with the browsers installed.
- Cross-browser checks, especially for WebKit, which teams without Macs otherwise find hard to test.
- Visual and accessibility checks, using screenshots and the accessibility tree.
- Automation and scraping: filling in forms, generating PDFs or collecting data from sites that render with JavaScript.
- AI agents that need to browse, click and read pages through the MCP server.
When to choose Playwright, and when not to
Choose Playwright when:
- Real user flows have to be verified before every release, not only individual functions.
- Safari and Firefox users matter, and you want to test WebKit and Firefox alongside Chromium.
- Tests need several tabs, several domains or several users in the same scenario.
- Your team wants one tool for TypeScript and Python or .NET services in the same organisation.
Look elsewhere when:
- You are testing pure logic. Unit tests with Jest or Vitest run in milliseconds and pinpoint failures better.
- The product is a native mobile app. Playwright emulates mobile browsers, not iOS or Android apps; Appium or Detox cover those.
- Your team already has a large, stable Cypress suite. Rewriting working tests rarely pays off on its own.
Browser tests are also the most expensive layer of a test suite to write and run. A healthy setup keeps most checks in fast unit and integration tests and uses Playwright for the flows that only a browser can prove.
Playwright and its alternatives
| Tool | Languages | Browsers | Best fit |
|---|---|---|---|
| Playwright | TS/JS, Python, .NET, Java | Chromium, Firefox, WebKit | Cross-browser E2E tests and automation |
| Cypress | JavaScript / TypeScript | Chrome, Edge, Firefox; WebKit experimental | Front-end teams that want an interactive runner |
| Selenium | Many languages | All major browsers via WebDriver | Large legacy suites and grid setups |
| Puppeteer | JavaScript / TypeScript | Chrome and Firefox | Chrome automation and scripting |
Cypress is the most common comparison. It has an excellent interactive runner and a strong following among front-end developers. Its own documentation lists testing several tabs and running several browsers at once among its permanent trade-offs, which are areas where Playwright's out-of-process design has an advantage, along with WebKit coverage and support for languages other than JavaScript.
Selenium is the long-established standard and drives browsers through the W3C WebDriver protocol. It supports more languages and older setups, but waiting and isolation are largely left to the team, which is where much of its reputation for flaky tests comes from.
How we use Playwright at Internative
We use Playwright to make sure applications behave the same way across browsers and platforms. Its stability, speed and tooling, especially traces for failed runs, let us validate complex user flows with confidence before a release goes out. We write those tests in TypeScript, next to the application code.
If you need a web application built with tests that hold it together release after release, our web application development team can help.
Frequently asked questions
Is Playwright better than Selenium?
For most new web projects, Playwright is easier to work with: it waits for elements automatically, isolates every test in a fresh browser context and ships a test runner, trace viewer and code generator. Selenium remains a reasonable choice for very large existing suites, for languages Playwright does not support, or for organisations built around a Selenium Grid.
Is Playwright Python or JavaScript?
Both. Playwright has official libraries for TypeScript and JavaScript, Python, .NET and Java. The Node.js version came first and includes Playwright Test, the most complete test runner; the other languages usually use their own test frameworks, such as pytest for Python.
Does Playwright require coding?
Tests are code, but you do not have to write every line by hand. The test generator records your clicks and typing in a browser and produces the test code, which you can then refine. Basic TypeScript or Python knowledge is enough to maintain such tests.
What is Playwright MCP?
Playwright MCP is a Model Context Protocol server from the Playwright project. It gives AI assistants and agents, in tools such as VS Code, Cursor or Claude Desktop, control of a real browser. The agent reads the page through structured accessibility snapshots instead of screenshots, which makes its actions more predictable.
Is Playwright hard to learn?
Developers who know JavaScript, TypeScript or Python can write useful tests within days. The core API is small, and auto-waiting removes the most frustrating part of browser testing. The longer learning curve is in test design: choosing what to test in the browser, managing test data and keeping a large suite fast.
Keep reading
The articles that follow this one.



