Testing

Selenium Is a Relic: Why Playwright Rules Browser Testing

By Geekery Team · · 6 min read

Selenium is a relic: why Playwright is the only testing framework that matters is not nostalgia talking. Selenium still works, but its architecture, tooling and maintenance burden belong to an earlier era of browser automation. Playwright gives UK engineering teams one API for Chromium, Firefox and WebKit, first-class waiting, trace debugging and parallel execution without a separate driver server.

That does not mean every Selenium suite deserves an immediate rewrite. It means new browser testing should default to Playwright, while existing coverage is migrated when the suite is touched. Teams serving GOV.UK, NHS Digital or Monzo-style platforms cannot justify choosing the older toolchain merely because Java test frameworks were built around it.

Selenium drags the browser and your team into the weeds

Selenium WebDriver communicates with a browser through a driver binary. The test sends commands, the driver translates them, and the browser reports back. That model was useful when browsers and operating systems were fragmented. It remains useful for specialist compatibility testing, but the day-to-day mechanics create avoidable work.

Versions must line up. Downloads need managing. Browser binaries need caching. Chrome updates can break a pipeline before anyone changes the application. Remote execution adds another moving part, and Selenium Grid historically requires its own operational attention. None of that is application testing; it is infrastructure tax paid by the team that owns the product.

The Java client also tends to pull large, verbose APIs into test code. A simple assertion can sit behind layers of WebElement handling, expected conditions and exception wrappers. The result is often readable by one framework and mysterious to everyone else. Python and JavaScript clients reduce the language burden, but they do not remove the underlying driver model.

Playwright makes browser automation feel native

Playwright controls browsers through a persistent connection and exposes browser contexts, pages, locators and network interception as core concepts. It can install pinned browser builds, record traces, capture videos, inspect DOM snapshots and run tests across Chromium, Firefox and WebKit from the same test suite.

The biggest improvement is automatic waiting. Playwright retries actions when an element is not ready, which removes the sleeps, polling loops and flaky waits that plague Selenium suites. The locator API is also deliberately narrow: locate by role, label, text or test id rather than relying on brittle CSS and XPath chains.

A test that explains its own failure

Traces are where Playwright earns its keep. When a test fails in CI, the trace shows the DOM, network activity, console output and screenshots at each step. That gives engineers evidence instead of a generic TimeoutError and a screenshot of a blank page. For a UK checkout team testing a payment flow, that difference can turn a 30-minute debugging session into a two-minute diagnosis.

import { test, expect } from "@playwright/test";

test("submits an accessible checkout form", async ({ page }) => {
  await page.goto("https://shop.example.test/checkout");

  await page.getByLabel("Email address").fill("[email protected]");
  await page.getByLabel("Delivery postcode").fill("SW1A 1AA");
  await page.getByRole("button", { name: "Continue to payment" }).click();

  await expect(
    page.getByRole("heading", { name: "Payment details" })
  ).toBeVisible();
});

That code is not exciting because it uses Playwright syntax. It is effective because the locators describe the interface a user sees. The button is found by its accessible name, the fields by their labels, and Playwright waits for the heading before the assertion. The test communicates intent without exposing implementation details.

One suite, three engines, less bespoke plumbing

Playwright runs the same test project against Chromium, Firefox and WebKit. That gives teams meaningful cross-browser coverage without maintaining three frameworks or custom driver harnesses. It is especially relevant for public-facing services where users switch browsers and operating systems unpredictably, from NHS appointment systems to retailer checkout journeys.

import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
  testDir: "./tests",
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  reporter: process.env.CI ? "github" : "html",
  use: {
    baseURL: "http://127.0.0.1:3000",
    trace: "on-first-retry",
    screenshot: "only-on-failure"
  },
  projects: [
    { name: "chromium", use: { ...devices["Desktop Chrome"] } },
    { name: "firefox", use: { ...devices["Desktop Firefox"] } },
    { name: "webkit", use: { ...devices["Desktop Safari"] } }
  ]
});

The configuration is straightforward, but the operational gain is substantial. Playwright downloads and pins its browser builds, so a pipeline does not depend on whatever Chrome version happens to be installed on the runner. Its test runner handles workers, retries, fixtures, parallelism and reporters. There is no Selenium Grid to scale, no driver version matrix to document and no separate service waiting for connections.

The performance advantage depends on the workload, so beware lazy benchmarks claiming a fixed speed-up. Playwright's direct browser protocol removes HTTP driver overhead, and its shared browser context can make many tests cheaper than starting a fresh browser each time. In real suites, the larger win often comes from reduced retries and faster diagnosis rather than raw execution time. Independent teams have reported major CI savings after replacing Grid and unstable waits, but the exact improvement depends on test design and infrastructure.

Where Selenium still has a reason to exist

Calling Selenium a relic does not make it useless. It remains the right choice when the immediate requirement is a very old browser, an unusual embedded webview or a device platform without a Playwright browser channel. Selenium can also make sense as a temporary bridge in a mature Java organisation with a large existing suite, stable Grid infrastructure and no immediate business need to rewrite.

Playwright does offer experimental Selenium support for migration, but a sensible migration is incremental. Map critical user journeys, add Playwright coverage for new features, and move existing tests when their business behaviour changes. Do not launch a heroic rewrite that stops shipping the product for months. Do not mix frameworks randomly across one journey either; that fragments fixtures and debugging tools.

There are trade-offs. Playwright's dependency footprint is larger than a bare HTTP client, and browser binaries need storage and caching on CI runners. Its API is opinionated, which is precisely why teams can share patterns, but it may not fit every legacy setup. Very large Java suites may also need time to standardise around its API rather than forcing old WebDriver habits into new files.

The practical verdict for UK engineering teams

Selenium is not dead, and pretending otherwise would be lazy analysis. It is a capable compatibility layer. But as the default choice for new browser testing, it is obsolete architecture. The driver indirection, separate binary management, Grid operations and hand-written waiting patterns create costs that Playwright removes by design.

For a new product, choose Playwright. For an established suite, replace Selenium as you touch it. For a genuinely constrained legacy platform, keep Selenium until the constraint disappears. That is the honest technical line.

Teams should judge browser automation by the quality of its feedback, not by how many wrappers they can wrap around WebDriver. Playwright gives engineers fast execution, reliable actions, cross-browser testing and replayable failure evidence in one package. Selenium asks them to keep the automation infrastructure alive. That is why Playwright is now the only sensible default, even if Selenium remains in the toolbox.

Is Playwright really faster than Selenium?

Often, yes. Playwright avoids the driver HTTP layer and can reuse a browser process between tests, but the result depends on the suite. A badly designed test with huge fixtures will be slow in either framework. Compare cold starts, retries, CI duration and engineer debugging time on your own workflows.

Can Playwright replace Selenium Grid?

For ordinary browser testing, yes. Playwright manages browser processes and parallel workers itself, and CI runners can shard tests by project or test file. Keep Selenium Grid only for browsers, devices or legacy clients that Playwright cannot drive.

Should an existing Selenium suite be rewritten?

Not all at once. Prioritise critical user journeys, build Playwright alongside Selenium, then migrate tests when they change or fail. A staged replacement reduces risk and avoids spending months recreating low-value coverage that should be deleted.