Choose between Puppeteer and Playwright, and migrate a Puppeteer script to Playwright

domain: playwright.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Choose Playwright when you need multi-browser support (Chromium, Firefox, WebKit), built-in test runner features (parallelism, retries, reporters), network interception, or mobile emulation out of the box.
  2. Choose Puppeteer when you want a minimal dependency footprint, are already deeply invested in a Puppeteer-specific API, or need Chrome DevTools Protocol features that Playwright does not yet expose.
  3. When migrating, replace `puppeteer.launch` with `chromium.launch` (or use the `test` fixture), and replace `page.waitForSelector` + `page.$` calls with Playwright locators (`page.locator`, `page.getByRole`, etc.).
  4. Replace Puppeteer's `page.waitForNavigation` paired with a click by Playwright's `Promise.all([page.waitForURL('**target**'), page.click('...')])` pattern, or simply rely on Playwright's auto-waiting.
  5. Replace Puppeteer's `page.on('request', ...)` / `page.setRequestInterception(true)` pattern with Playwright's `page.route(pattern, handler)` for cleaner mock/intercept code.

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans