Playwright
Microsoft's modern browser automation library. Multi-browser, fast, and reliable — the modern industry default for new web projects.
Overview
Playwright is an open-source browser automation framework developed by Microsoft, first released in 2020. It supports Chromium, Firefox, and WebKit with a single API. Unlike Selenium, Playwright uses native browser protocols (CDP for Chromium, Playwright protocols for Firefox/WebKit) rather than the older WebDriver standard, enabling faster and more reliable execution.
In 2026, Playwright dominates new project adoption in NZ tech teams. CloudBooks, ListRight, and TechServNZ job postings frequently list Playwright as a preferred or required skill. The framework is particularly strong for modern SPAs (React, Vue, Angular) where automatic waiting and network interception eliminate the flakiness common in older tools.
What it's used for
Playwright excels at:
- Cross-browser regression testing: Run the same test against Chrome, Firefox, Safari, and Edge with one codebase.
- CI/CD integration: Native sharding, parallel execution, and HTML/JSON/JUnit reporters make pipeline integration trivial.
- API + UI combined testing: Intercept network requests, mock APIs, and validate both frontend and backend behaviour in a single test.
- Visual regression: Built-in screenshot comparison with configurable thresholds.
- Mobile web simulation: Test responsive layouts by emulating viewport sizes and device pixel ratios.
Pros & Cons
Pros
- Auto-waiting eliminates most flaky tests without explicit sleeps
- Multi-browser support (Chromium, Firefox, WebKit) from one API
- Native parallel execution and test sharding for CI
- Excellent trace viewer for debugging failures
- Strong TypeScript support and VS Code extension
Cons
- Node.js ecosystem only — no native Java or C# bindings as mature as Selenium
- Not suitable for native mobile apps (use Appium instead)
- Smaller community than Selenium for legacy enterprise support
- Steep learning curve for teams migrating from Selenium WebDriver
Platforms & Integrations
Playwright runs on Windows, macOS, and Linux. It supports testing against Chromium, Firefox, and WebKit on all three platforms.
Pricing
| Tier | Cost | Includes |
|---|---|---|
| Open Source | Free | Full framework, all browsers, all features |
| Playwright Cloud | From $0.005/test | Managed execution, trace storage, team dashboards |
NZ Context
Playwright has become the default choice for greenfield projects across NZ tech employers — from SaaS product companies to digital agencies. The Playwright documentation quality makes it accessible for junior engineers, which has accelerated adoption at teams with mixed experience levels. NZ government agencies have embraced Playwright for internal portals and citizen-facing web applications, pairing it with internal CI infrastructure to meet NZISM security requirements. NZ e-commerce and fintech teams value the built-in WebKit support given NZ audiences' strong iOS usage, and the framework's ability to combine API interception with UI testing in a single run fits well with agile delivery cadences common in the local market.
Alternatives
- Selenium — The established standard. Better for legacy systems and multi-language enterprise teams.
- Cypress — Developer-friendly with time-travel debugging. Best for frontend-centric JavaScript teams.
- TestCafe — No WebDriver needed. Simpler setup for teams wanting quick wins without browser binaries.
When to choose Playwright
A quick decision guide for NZ teams evaluating ui / e2e automation options.
| Choose Playwright when… | Choose something else when… | Combine with… |
|---|---|---|
| Your stack is a modern SPA (React, Vue, Angular) and you need reliable auto-waiting without manual sleeps | Your team's existing automation is all Java/Selenium and rewriting is not in scope — Selenium stays | Jest / Vitest — run unit and component tests in Jest, Playwright handles browser-level integration and E2E |
| You need cross-browser coverage (Chrome, Firefox, WebKit/Safari) verified in CI on every PR | You are testing a native iOS or Android app — use Appium or Detox instead; Playwright has no native mobile support | Pact — use Playwright for UI flows and Pact for contract testing between microservices; they do not overlap |
| Your CI pipeline already runs Node.js and your team writes TypeScript — Playwright fits the existing toolchain with zero friction | You need to test heavily on real physical devices (iOS Safari bugs, touch behaviour) — BrowserStack or Sauce Labs with real devices is more reliable | axe-core / @axe-core/playwright — inject accessibility audits into Playwright tests to catch WCAG failures at the same time as functional regressions |
| You need network interception, mocked APIs, or combined API + UI test scenarios in a single test run | The team is frontend-only, tests purely in-browser, and Cypress's time-travel debugger is more important to them than cross-browser coverage | k6 — Playwright covers functional UI correctness; k6 handles load and performance testing against the same endpoints |
What I would do
Practitioner judgment on tool adoption, team onboarding, and when to swap.
page.waitForSelector auto-waiting model, and run both suites in CI in parallel for a two-week comparison. Concrete time and flake-rate data beats any argument. If the numbers hold, propose a staged migration of the highest-value test scenarios — not a big-bang rewrite.nth-child selectors with getByRole / getByTestId, and adding one assertion per test instead of five. The trace viewer is invaluable here — show failures visually before they've memorised the DOM.@axe-core/playwright into the existing Playwright suite and run checkA11y() on the five highest-traffic screens in every CI run. This catches regressions automatically without needing a dedicated accessibility tool licence. I would also add a WebKit run specifically for Safari — Harbour Bank's demographic skews heavily iOS, and WebKit surfaces a distinct class of colour-contrast and focus-order bugs that Chromium does not.The bottom line: Playwright's value comes from reliable selectors and auto-waiting — not from the number of browsers you run. Lock in getByRole and getByTestId conventions before your suite grows past 50 tests, or you will spend the next year maintaining brittle CSS selectors instead of shipping coverage.
Interview questions
Questions you are likely to get if you list Playwright on your CV — with what interviewers are really testing for.
What is the difference between Playwright and Selenium, and why would you choose one over the other?
What they’re really testing: Whether you understand the architectural difference between browser protocols (CDP vs WebDriver) and can reason about trade-offs rather than just listing features.
Strong answer covers: Playwright uses native browser protocols with built-in auto-waiting, while Selenium uses the WebDriver standard and requires explicit waits; Playwright is the default for modern SPAs in NZ greenfield projects (CloudBooks, ListRight); Selenium remains the better choice when a team has a large existing Java-based suite and a rewrite is not in scope.
When would you use Playwright over Cypress for a new NZ project?
What they’re really testing: Whether you understand the practical trade-offs between two modern tools rather than assuming one is universally superior.
Strong answer covers: Playwright when cross-browser coverage is required (especially WebKit/Safari for NZ audiences that skew iOS); Playwright when tests need to combine API interception with UI steps in a single run; Cypress when the team is frontend-focused and values the time-travel debugger over multi-browser support; acknowledge both are valid and the decision should follow the team’s stack and delivery constraints.
You’re working at a NZ government agency and your Playwright tests pass consistently on your laptop but fail roughly 30% of the time in the GitHub Actions pipeline. How do you investigate?
What they’re really testing: Systematic debugging discipline and familiarity with CI-specific failure modes — not just whether you can write tests, but whether you can own them when they break in production.
Strong answer covers: Open the Playwright trace viewer from the CI artefact first — it replays the exact failure with network, console, and DOM snapshots; check for timing differences (slower CI runners, cold-start network latency); look for hardcoded waits or non-deterministic selectors (e.g. nth-child depending on load order); consider using --retries 2 as a short-term stabiliser while fixing the root cause, not as a permanent fix; note that government CI environments may have stricter network egress rules that affect API mocks.
How would you structure a Playwright test suite for a large React application with 10+ engineers contributing?
What they’re really testing: Whether you think about maintainability and team conventions at scale, not just how to write a single passing test.
Strong answer covers: Page Object Model (or Playwright’s fixtures pattern) to encapsulate selectors and actions so individual tests stay readable; enforce getByRole and getByTestId conventions from day one to avoid CSS selector drift; split tests into fast smoke suite (critical paths, run on every PR) and slower regression suite (run nightly or on release branches); use Playwright’s built-in sharding to parallelise across GitHub Actions workers; document selector conventions in the team’s testing standards, particularly relevant if following NZISM or agency coding standards.
How would you use Playwright to verify that an accessibility remediation sprint actually fixed the reported issues — and that regressions don’t creep back?
What they’re really testing: Whether you connect test tooling to real delivery outcomes (accessibility compliance) rather than treating Playwright purely as a functional regression tool.
Strong answer covers: Integrate @axe-core/playwright and call checkA11y() on the highest-traffic screens in every CI run to catch regressions automatically; add a dedicated WebKit run because Safari (dominant on NZ iOS devices) surfaces a distinct class of colour-contrast and focus-order bugs that Chromium misses; tie test failures to specific WCAG 2.1 criteria so developers can action them without a separate audit; relevant for NZ public sector work where the Web Accessibility Standard 1.1 (based on WCAG 2.1 AA) is a compliance requirement.