Dev tools
Playwright vs Selenium vs Cypress: Which to Use?
Playwright vs Selenium vs Cypress compared: languages, browsers, speed, flaky tests, scraping and cost, with clear picks for new and legacy test suites.
Playwright vs Selenium comes down to this: for a new web test suite, Playwright is usually the better default, because it is faster to set up, waits for elements automatically and runs tests in parallel for free. Selenium is still the right choice when you need the widest language and browser support, a real Safari or old-browser grid, or you already have a large Selenium suite. Cypress sits in between: a pleasant tool for JavaScript teams testing their own front end, with more limits on tabs, origins and browsers.
This guide compares Playwright vs Selenium vs Cypress on how they work, languages, browsers, speed, flaky tests, AI features, web scraping and cost, then gives clear picks for different teams.
Playwright vs Selenium vs Cypress at a Glance
| Playwright | Selenium | Cypress | |
|---|---|---|---|
| Made by | Microsoft (open source, Apache 2.0) | Selenium project (open source, Apache 2.0) | Cypress.io (open source app, paid Cloud) |
| How it drives the browser | From outside, over a persistent connection | Through the W3C WebDriver standard (plus WebDriver BiDi) | From inside the browser, next to your app |
| Languages | JavaScript/TypeScript, Python, Java, .NET | Java, Python, C#, Ruby, JavaScript, Kotlin | JavaScript/TypeScript only |
| Browsers | Chromium, Firefox, WebKit | Chrome, Firefox, Edge, Safari and more | Chrome family, Firefox, WebKit (experimental) |
| Auto-waiting | Built in | Manual waits (implicit/explicit) | Built in (retrying assertions) |
| Parallel runs | Built in and free | Selenium Grid (self-hosted or a vendor) | Across machines mainly via paid Cypress Cloud |
| Multiple tabs and origins | Yes | Yes | Limited (cy.origin; tabs need a plugin) |
| Best for | New end-to-end suites, cross-browser, CI | Large or multi-language teams, legacy suites, real-device grids | JS front-end teams, component tests |
What Is Playwright?
Playwright is an open source browser automation and testing framework from Microsoft. It controls Chromium, Firefox and WebKit (the engine behind Safari) through one API, and runs on Windows, macOS and Linux. You can write tests in JavaScript or TypeScript, Python, Java or .NET.
Its test runner, Playwright Test, includes the things teams usually bolt on later: parallel workers, retries, HTML reports, screenshots and video on failure, a trace viewer that lets you step back through every action, a UI mode with time-travel debugging, and codegen, which records your clicks into test code. You start a project with npm init playwright@latest and run tests with npx playwright test, which by default runs headless and in parallel across all three browsers.
A minimal test, from Playwright's own docs:
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});What Is Selenium?
Selenium is the original open source browser automation project and still the most widely known. Its core, Selenium WebDriver, implements the W3C WebDriver specification, the web standard browsers follow for automation. Every major browser vendor ships a driver for it, which is why Selenium supports so many browsers and languages.
The Selenium project has three main parts:
- WebDriver: the libraries you write tests with, in Java, Python, C#, Ruby, JavaScript or Kotlin.
- Selenium Grid: runs tests in parallel across many machines and browser versions.
- Selenium IDE: a browser extension that records and plays back simple tests.
Modern Selenium also includes Selenium Manager, a tool that downloads the right browser driver automatically, removing the old "driver version mismatch" pain, and is adding WebDriver BiDi, a newer two-way protocol that brings features like listening to console logs and network events.
A first script in Python looks like this:
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.selenium.dev/selenium/web/web-form.html")
text_box = driver.find_element(by=By.NAME, value="my-text")
text_box.send_keys("Selenium")
driver.quit()What Is Cypress?
Cypress is a JavaScript testing tool that runs inside the browser, in the same run loop as your application. That gives it a great interactive runner: you watch tests execute, hover over each step and see a snapshot of the page at that moment. It supports end-to-end tests, component tests for React, Angular, Vue and Svelte, and API calls with cy.request.
The Cypress app is free and open source. Cypress Cloud is the paid service on top, with test replay, smart parallelization across machines, flaky test management and analytics.
describe('My First Test', () => {
it('Visits the Kitchen Sink', () => {
cy.visit('https://example.cypress.io')
cy.contains('type').click()
cy.url().should('include', '/commands/actions')
})
})Cypress documents its own trade-offs clearly: JavaScript is the only language it will support, it cannot drive two browsers at the same time, each test is bound to one site (other origins need cy.origin), multiple tabs need the @cypress/puppeteer plugin, and WebKit support is experimental.
Playwright vs Selenium: Key Differences
Setup and developer experience
Playwright installs its test runner, browsers and config in one command. Selenium is a library, so you pick your own test runner (JUnit, pytest, NUnit and so on), reporting and parallel setup. That freedom suits large teams with existing frameworks; it is slower for a new project.
Waiting and flaky tests
Flaky tests, ones that pass and fail at random, are the biggest cost in browser testing, and most come from timing. Playwright waits automatically for an element to be visible, stable and enabled before it clicks, and its expect assertions retry until they pass or time out. In Selenium you add explicit waits yourself; teams that do this well get stable suites, but it is easy to get wrong.
Speed
Playwright keeps one persistent connection to the browser and uses browser contexts, which are like fresh incognito profiles that start in milliseconds, so each test gets a clean state cheaply. Classic Selenium WebDriver sends commands as separate HTTP requests to a driver process, which adds overhead per step. In practice, test speed depends more on your app, your waits and parallelism than on the tool, but new Playwright suites are usually quicker to make fast.
Language and browser coverage
Selenium wins on breadth: more languages, and it can drive real Safari on macOS and older browser versions through Grid or cloud device farms. Playwright tests WebKit, which is the engine behind Safari, but it is Playwright's own WebKit build rather than the Safari app.
Community and hiring
Selenium has over a decade of answers, courses and testers who know it. Playwright has grown fast and is now the default choice in many new JavaScript projects, so finding help for either is easy.
Playwright vs Cypress
Playwright vs Cypress is the real decision for most new JavaScript and TypeScript projects:
- Architecture: Cypress runs inside the browser; Playwright controls it from outside. Running inside gives Cypress a superb interactive runner, but it also causes its limits with tabs, iframes and multiple origins. Playwright handles multiple tabs, windows, origins and even several browsers in one test.
- Browsers: Playwright treats Chromium, Firefox and WebKit as first-class. Cypress supports Chrome-family browsers and Firefox, with WebKit still experimental.
- Parallelism and cost: Playwright parallelizes for free on one machine and shards across CI machines with a flag. Cypress's built-in parallel runs across machines are part of paid Cypress Cloud, although you can split specs across CI jobs yourself.
- Languages: both support JavaScript and TypeScript; only Playwright also supports Python, Java and .NET.
- Component testing: both offer it. Cypress's component testing is mature and popular with React and Vue teams.
- Debugging: Cypress's time-travel runner is the classic strength; Playwright's UI mode and trace viewer now offer much of the same.
If your team loves the Cypress runner and only tests a single-origin JavaScript app in Chrome, Cypress remains a fine choice. For everything else, Playwright is usually the safer pick.
Playwright vs Puppeteer
Playwright vs Puppeteer is a different comparison, because Puppeteer is a browser automation library, not a test framework. Puppeteer is Google's Node.js library for controlling Chrome (and Firefox through WebDriver BiDi). Playwright was created later by engineers who had worked on Puppeteer, and adds more browsers, more languages, auto-waiting and a full test runner.
- Use Puppeteer for Chrome-focused scripts in Node.js: PDFs, screenshots, simple crawling.
- Use Playwright when you need testing features, WebKit or Firefox, or languages other than JavaScript.
Playwright vs Selenium for Web Scraping
For scraping JavaScript-heavy pages, both work, and Cypress is not designed for it (its own docs say it is not a general-purpose automation tool). Comparing Playwright vs Selenium for web scraping:
- Playwright is usually easier: automatic waiting means fewer sleeps, it can intercept and block network requests (skip images and ads to save bandwidth), read API responses directly, and run many isolated browser contexts in one browser process.
- Selenium is fine if your team already uses it, especially from Python or Java, and its Grid can spread work over many machines.
- Either way, a real browser is the slow path. If the data comes from a JSON API the page calls, fetching that directly is far faster. Respect robots.txt, terms of service, rate limits and privacy law when you scrape.
AI Features: Agents, MCP and Self-Healing Tests
AI has reached browser testing in three ways:
- Browser control for AI agents: Playwright is the engine behind many AI browser agents, and Microsoft publishes a Playwright MCP server so assistants like Claude or Copilot can open pages, click and read results. Our list of the best MCP servers covers it, and our guide to computer use AI explains how agents that click and type work.
- Test generation and repair: Playwright ships three Test Agents: a planner that explores your app and writes a Markdown test plan, a generator that turns the plan into test files, and a healer that runs the suite and repairs failing tests. You set them up with
npx playwright init-agentsand a--loopoption for your AI tool (for example VS Code or Claude Code). - Cypress AI: Cypress offers Studio AI, which suggests assertions while you record,
cy.promptfor generating test steps from plain language, and a Cloud MCP server that gives coding assistants your run and failure data.
Treat AI-written tests like any AI-written code: review them before they gate your releases. Our guide to AI code review covers how to keep that review honest.
Cost: All Three Are Free to Start
All three tools are free and open source at their core. The costs come from running them:
- Playwright: free, including parallel runs and reports. You pay for CI minutes, and optionally for a cloud browser service.
- Selenium: free. A self-hosted Grid costs servers and maintenance time; real-device and old-browser coverage usually means a paid cloud grid.
- Cypress: the app is free; Cypress Cloud is a paid subscription for replays, cross-machine parallelization and analytics.
The biggest cost for any of them is engineer time spent fixing flaky tests, which is why built-in waiting and good debugging tools matter more than licence price.
Migrating From Selenium to Playwright
If you are moving a suite, don't rewrite it in one go:
- Write all new tests in Playwright and leave the old Selenium tests running.
- Port the flakiest Selenium tests first, since they cost you the most.
- Replace explicit waits with Playwright's web-first assertions instead of copying
sleepcalls. - Use locators by role and text (
getByRole,getByText) rather than long CSS or XPath selectors. - Retire Selenium tests once the Playwright versions have been stable for a few weeks.
Playwright vs Selenium vs Cypress: Which Should You Choose?
| Your situation | Pick |
|---|---|
| New web app, any language, need cross-browser in CI | Playwright |
| Big existing Selenium suite that works | Keep Selenium; write new tests in Playwright if you like |
| Team writes tests in Ruby or Kotlin, or must run on real Safari or old browsers | Selenium |
| JavaScript team, single-origin app, loves an interactive runner, wants component tests | Cypress |
| Scraping JavaScript-heavy sites | Playwright (or the site's API) |
| Chrome-only scripts for PDFs and screenshots | Puppeteer or Playwright |
| AI agents that browse the web | Playwright (via its library or MCP server) |
FAQ
Is Playwright better than Selenium?
For most new projects, yes: Playwright is quicker to set up, waits automatically, runs in parallel for free and has better debugging tools. Selenium is better when you need its wider language and browser coverage, a real Safari or device grid, or you already have a large working suite.
Is Playwright replacing Selenium?
Playwright has become the most common choice for new JavaScript and TypeScript test suites, but Selenium is still heavily used, especially in large companies, in Java and C# teams, and for real-device testing. Many teams run both during a gradual move.
Which is easier to learn, Playwright or Selenium?
Playwright is usually easier for beginners because it includes the test runner, reports and waiting behaviour, and codegen can record your first tests. Selenium asks you to assemble those pieces and handle waits yourself.
Can Playwright test Safari?
Playwright tests WebKit, the browser engine behind Safari, on Windows, macOS and Linux. That catches most Safari issues, but it is not the Safari app itself. For real Safari on Mac or iPhone, use Selenium with SafariDriver or a cloud device service.
Is Cypress still worth using?
Yes, for JavaScript teams testing their own single-origin app who value its interactive runner and component testing. If you need multiple tabs or origins, full WebKit support, other languages or free cross-machine parallelization, Playwright fits better.