PROVIDER Β· the new cross-browser E2E standard
Playwright
Playwright is Microsoft's cross-browser E2E framework driving Chromium, WebKit, and Firefox through one API where web-first waiting and the Trace Viewer balance stability with observability and CI sharding stays free.
Pros
Cons
Product Information
Detailed Notes
Overview
Playwright was released by Microsoft in 2020 with a team largely from Puppeteer, driving Chromium, WebKit, and Firefox engines through one API with multi-tab, iframe, multi-origin, and mobile emulation support.
For Programming Languages & Frameworks work the value is the balance of coverage and stability, since real WebKit support covers Safari behaviour, web-first assertions reduce flaky cases markedly, the Trace Viewer replays full execution, and CI shards run in parallel for free without commercial cloud.
Note the boundaries, because ecosystem and a visual debugging UI arrived after Cypress though the Trace Viewer largely closes the gap, scripts need programming skill limiting non-technical participation, Python, Java, and .NET bindings exist while TypeScript dominates, and real iOS devices need extra tooling.
Core Strengths
- One API covering Chromium, WebKit, and Firefox
- Web-first auto-waiting assertions cutting flakiness
- A Trace Viewer replaying execution with network and snapshots
- Free CI sharding with TypeScript, Python, Java, and .NET bindings
Product Ecosystem
Core API
page.goto, locators, expect assertions, fixtures, and test.describe structure.
Debugging
The Trace Viewer, codegen recording, UI mode, and the VS Code extension.
Running and extension
Multi-language bindings, device emulation, shard parallelism, and Docker images.
Drawbacks
- Ecosystem and UI started later than Cypress
- Scripts need programming skill raising the barrier for non-technical members
- Real mobile devices need extra services like BrowserStack
- Browser binaries are large requiring prebuilt CI images
Use Cases
- Cross-browser E2E testing (β β β β β ) - All three engines
- Stable large-scale CI suites (β β β β β ) - Free sharding
- Scraping and automation (β β β β β ) - Beyond testing
- Non-technical test authors (β β β ) - Programming required
Pricing
| Plan | Price | Scope |
|---|---|---|
| Playwright | $0 | Apache 2.0, free |
| CI parallelism | $0 | Free sharding |
| Device clouds | Usage billing | BrowserStack, Sauce Labs |
Entirely free including CI sharding, a clear cost advantage over Cypress Cloud, where the real investment is maintenance since E2E cases track UI changes and stable data-testid selectors reduce fragility.
FAQ
-
Playwright or Cypress? Playwright for multi-browser, multi-tab, and free parallelism while Cypress suits those prioritising interactive debugging.
-
Can it scrape? Yes with capabilities beyond testing for interception, device emulation, and script injection, respecting site terms and rate limits.
-
How is flakiness fixed? Replace fixed waits with web-first assertions, use data-testid selectors, analyse traces, and isolate test data.
Code Examples
A critical flow test
import { test, expect } from '@playwright/test';
test('data center list loads and opens details', async ({ page }) => {
await page.goto('/');
await expect(page.getByTestId('plan-card')).toHaveCount(3);
await page.getByRole('link', { name: 'Hong Kong VPS' }).click();
await expect(page).toHaveURL(/\/plans\/hk/);
});
Web-first assertions retry until timeout removing the need for waitForTimeout.
Multiple browsers and sharding
npx playwright test --project=chromium --project=webkit --project=firefox
npx playwright test --shard=1/3 # free sharding in CI
npx playwright show-trace trace.zip # replay the failure
Community & Resources
Communities and official channels
- Playwright Site β Docs, examples, and updates
- GitHub microsoft/playwright β Source, issues, and releases
- Stack Overflow #playwright β Selector and stability answers
Learning resources and tools
- Getting Started β Install and first test
- Trace Viewer β Replay failures and debug
- Best Practices β Selectors and test structure