What Is Playwright?

Playwright is an open-source framework from Microsoft for testing web applications. With one API it automates Chromium, Firefox and WebKit, and its test runner (Playwright Test) adds auto-waiting, assertions, parallel execution, API testing and powerful debugging tools.

Key Features

  • End-to-end UI testing and API testing in one framework.
  • Cross-browser testing across Chromium, Firefox and WebKit.
  • Auto-waiting before every action, which removes most flaky waits.
  • Handles modern web apps — single-page applications, dynamic elements and network calls, including mocking them.
  • Built-in trace viewer, UI mode and codegen for debugging and writing tests.

In real projects, Playwright is mainly used to automate critical user journeys such as login, payments, form submissions and validations.

Interview Answer

"Playwright is an open-source automation framework developed by Microsoft for testing web applications. It automates Chromium, Firefox and WebKit through one API, provides built-in auto-waiting and assertions, runs tests in parallel in isolated browser contexts, and also supports API testing and network mocking."

⚡ Playwright at a glance
Made byMicrosoft (open source, Apache-2.0 licence)
First releasedMicrosoft published the first versions on npm in December 2019; Playwright 1.0 was released on 6 May 2020
Latest stable version1.63 (September 2026)
BrowsersChromium (Chrome, Edge), Firefox and WebKit (Safari engine) — with one API
LanguagesJavaScript/TypeScript, Python, Java and .NET (C#)
Best known forAuto-waiting, web-first assertions, parallel tests, API testing, network mocking and trace debugging

Release dates and version taken from the official npm registry.

Advertisement

Why Do We Use Playwright?

Problem in Older Approaches How Playwright Solves It
Synchronisation issues cause flaky failures Auto-wait before actions; assertions retry automatically
Cross-browser testing needs separate drivers and setups One framework, three browser engines, installed with one command
Dynamic elements and SPAs are hard to automate Locators re-query the page each time, so they don't go stale
Slow test isolation Lightweight browser contexts — a fresh "incognito" session per test in milliseconds
Hard to test error handling Network interception and mocking with page.route()
Hard to debug CI failures Trace viewer with screenshots, DOM snapshots and network logs

How Playwright Works

Your test talks to the browser over a persistent WebSocket connection, using browser-level protocols (the Chrome DevTools Protocol for Chromium, and Playwright's own protocol for its patched Firefox and WebKit builds).

Inside one browser instance, Playwright creates browser contexts — isolated sessions with their own cookies and storage — and each test gets its own context and page:

Browser → Browser context (one per test) → Page (a tab)

This is why Playwright tests are isolated from each other yet start quickly.

More: Playwright vs Selenium vs Cypress Architecture.

Browser Support

Playwright supports three browser engines:

  • Chromium — the engine behind Google Chrome and Microsoft Edge. You can also run the branded browsers with channel: 'chrome' or 'msedge'.
  • Firefox — a Playwright build of Firefox.
  • WebKit — the engine behind Safari, so you can test Safari-like behaviour even on Windows and Linux.

It also emulates mobile devices (viewport, touch, user agent) such as an iPhone or Pixel. Projects in the config file run the same tests across all of them:

projects: [
  { name: 'chromium',      use: { ...devices['Desktop Chrome'] } },
  { name: 'firefox',       use: { ...devices['Desktop Firefox'] } },
  { name: 'webkit',        use: { ...devices['Desktop Safari'] } },
  { name: 'Google Chrome', use: { ...devices['Desktop Chrome'], channel: 'chrome' } },
  { name: 'Mobile Safari', use: { ...devices['iPhone 13'] } },
],

Compared With Selenium

Selenium drives the real branded browsers — Chrome, Firefox, Edge and Safari — through separate drivers. Playwright uses its own builds of the three engines that power almost all modern browsers.

Internet Explorer is retired and no longer a target for either.

See Selenium vs Playwright.

Language Support

Playwright has official libraries for TypeScript/JavaScript, Python, Java and .NET (C#), so teams can automate in the language of their stack.

The Node.js version includes Playwright Test, the most complete test runner — which is why most teams choose TypeScript.

In one real project, automation was implemented using Playwright with TypeScript.

Open Source and Developed by Microsoft

  • Free and open source under the Apache 2.0 licence.
  • Strong documentation and community, with frequent releases.
  • Regular browser updates — each Playwright release ships with matching browser builds.

In a banking web application, Playwright updates ensured compatibility with the latest Chrome and Safari versions, allowing cross-browser regression testing without extra driver maintenance.

Getting Started

npm init playwright@latest        # creates the config, an example test and installs browsers
npx playwright test               # run all tests (headless by default)
npx playwright test --headed      # watch the browser
npx playwright test --ui          # interactive UI mode
npx playwright codegen https://playwright.dev   # record actions as code

Then write your first test — see The Complete Playwright Tutorial.

Headless vs Headed Mode

  Headless Headed
Browser window Not shown Visible
Speed Faster, fewer resources Slower — the UI is rendered
Best for CI/CD, Jenkins, cloud runs, nightly regression Writing and debugging tests, demos
Default Yes, in Playwright Test Opt in

Switching Modes

npx playwright test --headed      # headed for one run

In playwright.config.ts:

use: { headless: false }

Or when launching a browser directly — slowMo makes each step easy to follow:

const browser = await chromium.launch({
  headless: false,
  slowMo: 500
});

For debugging, UI mode (--ui) and the trace viewer are usually even better than headed mode — see Playwright Reports & Debugging.

Real Project Usage

  • Headless for regression suites, nightly runs and CI/CD pipelines.
  • Headed for debugging failed tests and demonstrating automation.

In a real project, running Playwright headless across all supported browsers on Jenkins, with parallel browser contexts, cut regression execution time by about 50%.

How Playwright Is Used in a Real Project

  • Applications: an e-commerce web application and a banking web application.
  • Role: automation tester.
  • Technology: Playwright with TypeScript, integrated with a Jenkins CI/CD pipeline.
  • Responsibilities: automated smoke, sanity and regression suites, and cross-browser testing across Chrome, Firefox and Safari (WebKit).

From Real Projects

My own automation experience is with Selenium WebDriver, Java and TestNG in a POM-based hybrid framework, running in batch, parallel and cross-browser mode. The concepts on this page carry straight over to Playwright — page objects, independent tests, parallel execution and reliable synchronisation — which makes it a natural next tool for Selenium testers. The biggest difference you'll notice is how much waiting Playwright handles for you. Testing Testsigma — a platform where users write automated tests in plain English — meant thinking like its users, who are testers themselves. Start by running the example tests and opening the report — it shows how Playwright structures a run.

📚 Official documentation: Playwright docs: Installation · Playwright docs: Browsers

What Can Playwright Do?

Playwright covers much more than clicking through pages. Out of the box it can:

  • Test in Chromium, Firefox and WebKit with the same code, including Safari's engine on Windows and Linux.
  • Wait automatically for elements to be visible, enabled and stable before acting, so you rarely write waits yourself.
  • Mock and intercept network calls with page.route(), to test error states without breaking the backend.
  • Test APIs with the built-in request fixture, in the same test as the UI.
  • Emulate mobile devices, geolocation, time zones and dark mode.
  • Handle multiple tabs, users and sessions through isolated browser contexts.
  • Record and debug: codegen writes tests while you click, and the Trace Viewer replays every step of a failed run.
  • Run tests in parallel and produce an HTML report with screenshots and videos.

Getting from zero to a first passing test takes a few minutes:

npm init playwright@latest      # creates the project, config and an example test
npx playwright test             # runs all tests headless
npx playwright codegen          # records a test as you click
npx playwright show-report      # opens the HTML report
import { test, expect } from '@playwright/test';

test('home page has the right title', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  await expect(page).toHaveTitle(/Playwright/);
});

FAQs

What Is Playwright?

An open-source framework from Microsoft for testing web applications across Chromium, Firefox and WebKit, with built-in auto-waiting, a test runner, API testing and debugging tools.

Why Do We Use Playwright?

For reliable tests with auto-waiting, fast isolated execution through browser contexts, cross-browser coverage from one framework, network mocking and excellent debugging.

Which Browsers Does Playwright Support?

Chromium (Chrome, Edge), Firefox and WebKit (Safari's engine), plus mobile device emulation.

Which Programming Languages Does Playwright Support?

TypeScript/JavaScript, Python, Java and .NET (C#).

What Is a Browser Context?

An isolated, incognito-like session inside a browser with its own cookies and storage. Playwright gives each test its own context.

What Is the Difference Between Headless and Headed Mode?

Headless runs without a visible window — faster and ideal for CI/CD. Headed shows the browser — useful for debugging and demos.

Is Playwright Free?

Yes — it's open source under the Apache 2.0 licence.

When was Playwright launched?

Microsoft released Playwright publicly in January 2020, and version 1.0 followed in May 2020. Several of its creators had previously built Puppeteer at Google.

Does Playwright use WebDriver?

No. Playwright talks to the browsers directly over a persistent connection instead of going through WebDriver and separate driver executables. That's one reason it's fast and can auto-wait reliably.

Is Playwright better than Selenium?

Neither is better for every team. Playwright is faster to set up, auto-waits and includes a test runner, tracing and API testing. Selenium supports more languages and older browsers and has a much larger job market, especially with Java. See the full Selenium vs Playwright comparison.

Next Steps