Playwright

Trace of a failed test: screenshot timeline, action list and a strict-mode error on a locator that matched five links

Chromium, Firefox and WebKit behind a single API

Playwright drives Chromium, Firefox and WebKit through one API, in JavaScript or TypeScript, Python, .NET and Java. Microsoft ships it in several forms: Playwright Test, an end-to-end test runner; the playwright library for scripts; and an MCP server plus a CLI aimed at AI agents.

Strict locators and a blank profile per test

  • Locators that refuse to guess: getByRole and getByLabel find elements the way a user would describe them. When a locator matches more than one element, the action throws instead of clicking the first hit.
  • Waiting built in: Playwright waits until an element is actionable before touching it, and expect assertions retry until the condition holds.
  • A fresh context for every test: the equivalent of a new browser profile, with its own cookies and storage. A logged-in session can be saved once with storageState and reused by the other tests.
  • Replayable traces: every action with its DOM snapshot, plus network requests and console output, reopened in the Trace Viewer.
  • Tests recorded from clicks: npx playwright codegen writes the test code while someone clicks through the app in a browser.

Screenshot baselines and agent-driven browsing

  • Suites run against all three engines, or against the Google Chrome and Microsoft Edge installed on the machine (the channel option).
  • Visual regression with toHaveScreenshot(), which compares each capture against a reference saved on the first run.
  • Scripts outside any test suite: screenshots, PDFs, iPhone 15 emulation, requests blocked with page.route. The PlaywrightCrawler in Crawlee is built on it.
  • Handing a browser to an AI agent through the MCP server, which describes the page as an accessibility tree rather than as screenshots.

Patched browsers pinned to each Playwright release

Not the Safari or Firefox your users run. Playwright downloads its own browsers, and each release needs specific builds, so every upgrade ends with npx playwright install. Its Firefox and WebKit depend on patches, and the docs state that it does not work with the branded versions. The WebKit under test comes from WebKit's main branch, often ahead of Safari.

The Playwright Test runner is a Node.js tool. The docs pair Python with a pytest plugin, Java with JUnit or TestNG, and .NET with base classes for MSTest, NUnit or xUnit.

One worker in CI, on the docs' own advice. The CI guide recommends workers: 1 for stability, and sharding across machines for more parallelism. Rendering shifts with the OS, the hardware and headless mode, so screenshot baselines should come from the environment that runs the tests.

A Docker image meant for testing. The docs reserve it for testing and development and advise against using it to visit untrusted sites. It runs browsers as root, which disables Chromium's sandbox; for scraping, the docs recommend a separate user and the seccomp profile.

On Android, only Chrome and WebView, and experimental. The docs warn that not everything works on a device. Native apps call for a tool such as Maestro.

Migration guides for Puppeteer and Protractor users. The docs include migration guides from Puppeteer, Protractor and Testing Library; the Puppeteer one says most Puppeteer APIs can be used as is.

A minor release roughly every five weeks, still on 1.x. Six minor versions came out between 1.59.0 on 1 April and 1.64.0 on 7 October 2026, followed by 1.64.1 on 14 October. The last commit is dated 27 October. The docs require Node.js 22, 24 or 26 and at least macOS 14; on Linux they list Debian 12 and 13 and Ubuntu 22.04, 24.04 and 26.04.