New videos every week — proxies, VPNs & antidetect browsers, explained.

Subscribe
ComparisonsDec 1, 202614 min read

Playwright vs Puppeteer vs Selenium for Web Scraping

Playwright, Puppeteer and Selenium compared for scraping: languages, contexts, auto-waiting, browsers, proxy support, detection and when each wins.

Table of contents

If you are about to build a browser-based scraper, the first real decision is not which proxy to buy. It is which automation library will drive the browser. Playwright, Puppeteer and Selenium can all open a page, click a button and read the rendered DOM, so on a hello-world script they look interchangeable. They stop looking interchangeable once you need fifty isolated sessions, a different proxy per session, reliable waits on a JavaScript-heavy site, or a team that writes Python instead of Node.js.

This guide compares the three tools specifically for web scraping: the languages they support, how they model browsers, contexts and pages, how they wait for elements, which engines they can drive, how they take proxies, and what each one means for detection. It is a tools comparison, not a vendor list, and every capability claim below was checked against the official Playwright, Puppeteer and Selenium documentation on 1 December 2026. If you need the basics first, read what web scraping is and how it works.

The short answer

For most new scraping projects, Playwright is the default pick: one API across Chromium, Firefox and WebKit, cheap isolated browser contexts that can each carry their own proxy, and actionability-based auto-waiting that removes most sleep-and-retry code. Puppeteer is the lean choice if you live in JavaScript, mostly target Chrome and want a small, close-to-the-browser library with first-party Chrome tooling. Selenium still wins when you need the W3C WebDriver standard, the widest language coverage, branded browsers including Safari, or an existing Selenium Grid your organisation already runs.

Versions checked

At the time of writing the latest releases on the npm and PyPI registries were Playwright 1.65 (npm 1.65.1, PyPI 1.65.2), Puppeteer 25.19.0 and Selenium 4.54.0. All three ship frequently, so treat any behaviour described here as current-as-of-today and confirm against the release notes of the version you pin.

What each tool actually is

Playwright

Playwright is Microsoft's browser automation library. Its homepage describes it as one API to drive Chromium, Firefox and WebKit, available for TypeScript, Python, .NET and Java. It ships its own test runner (Playwright Test) for Node.js, a pytest plugin for Python, base classes for MSTest, NUnit and xUnit in .NET, and works with JUnit or TestNG in Java. For scraping you usually ignore the test runner and use the library directly.

A key detail: Playwright downloads its own browser builds. Its Firefox and WebKit are patched builds, and the docs state plainly that Playwright does not work with the branded versions of Firefox or Safari because it relies on those patches. For Chromium it can also drive the branded Google Chrome and Microsoft Edge installed on the machine through channels such as chrome and msedge.

Puppeteer

Puppeteer is the Chrome team's JavaScript library. Its documentation describes it as a high-level API to control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi, running headless by default. Since v20 it downloads Chrome for Testing, and since v23 it can download and drive stable Firefox. There is an official JavaScript/TypeScript package (puppeteer, which downloads a browser, and puppeteer-core, which does not); other languages rely on community ports.

Selenium

Selenium is the oldest of the three and the reference implementation behind the W3C WebDriver specification. Its official bindings cover Java, Python, C#, Ruby and JavaScript, with Kotlin examples in the documentation. Instead of bundling patched browsers, Selenium talks to each vendor's own driver (chromedriver, geckodriver, msedgedriver, safaridriver), and Selenium Manager, a Rust tool shipped with every release, now downloads matching drivers and browsers automatically. Selenium Grid lets you route sessions to remote machines for parallel runs.

Diagram comparing how Playwright, Puppeteer and Selenium connect a script to a browser: Playwright and Puppeteer over a direct protocol, Selenium through a driver
How each tool reaches the browser: Playwright and Puppeteer speak a browser protocol directly, while Selenium goes through each vendor's WebDriver driver.

Side-by-side comparison

FeaturePlaywrightPuppeteerSelenium
Official languagesTypeScript/JavaScript, Python, Java, .NETJavaScript/TypeScriptJava, Python, C#, Ruby, JavaScript (Kotlin examples)
BrowsersChromium, patched Firefox, patched WebKit; branded Chrome and Edge via channelsChrome for Testing, stable FirefoxBranded Chrome, Edge, Firefox, Safari through vendor drivers
ProtocolIts own protocol to patched browsers; CDP for ChromiumChrome DevTools Protocol or WebDriver BiDiW3C WebDriver, plus WebDriver BiDi when enabled
Isolation unitBrowser context (incognito-like profile)Browser context via createBrowserContext()Usually one driver session per profile
WaitingAuto-waits on actionability checksLocators auto-wait; lower-level APIs do notImplicit or explicit waits you configure
Proxy scopePer browser or per context, with username and passwordPer browser (launch flag) or per context; credentials via page.authenticate()Per session via the proxy capability; auth through BiDi handlers or workarounds
ScalingMany contexts in one browser; sharding in the test runnerMany contexts in one browser; you build the poolSelenium Grid across machines
RecorderCodegen with Playwright InspectorChrome DevTools Recorder exportSelenium IDE

Browsers, contexts and pages: the model that matters most for scraping

Scraping at any volume is really about sessions: separate cookie jars, separate local storage, often a separate exit IP for each. How a library models sessions decides how much memory you burn and how much glue code you write.

Playwright is built around browser contexts. Its isolation docs describe them as incognito-like profiles that are fast and cheap to create and completely isolated, even when running in a single browser. You launch one browser process, then open as many contexts as your machine can handle, each with its own cookies, storage, viewport, locale, timezone and proxy. That is the closest thing to a ready-made session pool any of the three offers.

Puppeteer has the same concept through browser.createBrowserContext(). Its BrowserContextOptions include proxyServer and proxyBypassList, so you can give each context a different upstream. The difference is mostly ergonomics: Playwright pushes you toward contexts by default, while in Puppeteer it is easy to keep opening pages in the default context and accidentally share cookies across jobs.

Selenium traditionally maps one session to one driver and one browser instance. Isolation is strong because every session is a fresh profile, but each one costs a full browser process. That is fine for a few parallel sessions on a laptop and expensive at hundreds, which is exactly why Selenium Grid exists: you spread those processes across machines rather than packing them into one.

Rule of thumb

If your job needs many short, isolated sessions against the same site, contexts (Playwright or Puppeteer) will usually be lighter than one browser per session. If you need long-lived sessions on real branded browsers across many machines, Selenium Grid's model fits better.

Waiting and reliability

Most flaky scrapers fail on timing, not on selectors. The page has not rendered the price yet, a modal is covering the button, or a list is still animating. The three tools handle this very differently.

Playwright performs actionability checks before every action. For locator.click() its documentation lists that the locator must resolve to exactly one element, and that element must be visible, stable (not animating), able to receive events (not obscured), enabled and not inert. If the checks do not pass within the timeout, the action fails with a TimeoutError instead of clicking the wrong thing. Its user-facing locators, such as getByRole and getByLabel, also tend to survive markup changes better than long CSS paths.

Puppeteer added a Locator API that does much the same for the actions it covers. The docs say a locator click ensures the element is in the viewport, waits for it to become visible, waits for it to become enabled and waits for a stable bounding box. Older Puppeteer code built on page.$() and waitForSelector() does not get those guarantees, so check which style an example uses before copying it.

Selenium leaves waiting to you. Its docs describe two mechanisms: an implicit wait, a global setting whose default is 0, and explicit waits, where you poll for a condition with WebDriverWait. Explicit waits are precise and powerful, but you write them for every interaction that can race, and mixing implicit and explicit waits is a common source of confusing timeouts.

// Playwright: the click waits for actionability on its own
await page.getByRole('button', { name: 'Load more' }).click();

// Puppeteer: use the Locator API to get similar waiting
await page.locator('button.load-more').click();
# Selenium (Python): wait explicitly for the condition you need
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

btn = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "button.load-more"))
)
btn.click()

Proxy support compared

This is where the tools diverge most for scraping, so it is worth being precise.

Playwright documents that a proxy can be set globally for the browser or for each browser context, over HTTP(S) or SOCKS5, with an optional username and password for HTTP(S) proxies and a bypass list. Per-context proxies are the feature that makes Playwright attractive for rotating or sticky residential sessions: one browser, many contexts, each pinned to a different gateway session. Our Playwright proxy guide walks through the working code.

Puppeteer sets the proxy server at launch with Chrome's --proxy-server argument, or per context with proxyServer. Credentials are not part of that string: Puppeteer's docs point you to page.authenticate(), which turns on request interception behind the scenes and, as the docs note, can affect performance. See how to use proxies with Puppeteer for the full pattern.

Selenium passes a proxy through the standard proxy capability in browser options. The classic pain point is authenticated proxies, because WebDriver itself has no field for proxy credentials. With WebDriver BiDi enabled, Selenium now documents authentication handlers that answer Basic or Digest challenges programmatically; otherwise teams fall back to IP allowlisting or helper tools. Our Selenium proxy guide covers the options in detail.

// Playwright: a different proxy per context
const browser = await chromium.launch();
const ctx = await browser.newContext({
  proxy: { server: 'http://gate.example.com:8000', username: 'user-session-1', password: 'pass' }
});
const page = await ctx.newPage();
await page.goto('https://httpbin.org/ip');

SOCKS5 and passwords

Playwright's docs only mention username and password for HTTP(S) proxies. If your provider gives you an authenticated SOCKS5 endpoint, check whether it also offers an HTTP endpoint or IP allowlisting before you build around SOCKS5 in a Chromium-based tool.

Diagram of one browser holding three isolated contexts, each routed through its own proxy session to a target site
One browser, several isolated contexts, each with its own proxy session: the pattern Playwright and Puppeteer contexts make cheap.

Engine coverage and what it means for scraping

For scraping you rarely need three engines. Most targets are built and tested for Chromium, and most anti-bot vendors see Chrome as the bulk of real traffic. Engine choice still matters in two situations.

First, when a site behaves differently or blocks one engine, being able to switch to Firefox or WebKit without rewriting your scraper is useful. Playwright makes that a one-line change. Puppeteer can switch to Firefox. Selenium can switch to any browser with a driver, including real Safari on macOS.

Second, authenticity. Playwright's Firefox and WebKit are patched builds, not the branded browsers your visitors use. Puppeteer and Selenium drive stock Chrome for Testing, stable Firefox, or the branded browser installed on the machine. That does not automatically make one tool stealthier, but it is a real difference in what the target sees.

Detection realities: no library is invisible

It is tempting to pick a tool because a forum thread said it is "undetectable". None of them are. All three automate a real browser, and anti-bot systems look at far more than which library sent the commands.

  • Automation flags. Standards-compliant automation exposes signals such as navigator.webdriver. Stealth plugins and patched forks hide some of them, but they chase a moving target.
  • Headless differences. The old headless Chrome was a separate program with noticeable differences. Puppeteer now treats it as chrome-headless-shell, and Playwright documents opting into Chrome's new headless mode, which Chrome describes as the real browser and therefore more authentic.
  • Network fingerprints. TLS and HTTP/2 fingerprints come from the browser build, not the library. A real Chrome build usually looks like Chrome regardless of which tool drives it.
  • IP reputation and behaviour. A datacenter IP with a known history, or a session that loads 500 pages a minute, gets flagged no matter how clean the browser is. Read why proxies get blocked for the network side of this.

In practice the biggest detection wins come from sensible pacing, realistic session lengths, matching locale and timezone to the exit IP, and decent proxies. The library is a smaller factor than most people expect.

Developer experience and tooling

Playwright has the richest built-in tooling. npx playwright codegen opens a browser and the Playwright Inspector, records your clicks and writes the locator code for you. Trace Viewer lets you step back through a failed run with DOM snapshots and network logs, which is very useful when a scraper fails only on a server. It also now ships an MCP server and a CLI aimed at AI coding agents.

Puppeteer is smaller and closer to Chrome. You can record a flow in the Chrome DevTools Recorder and export it, and because the Chrome team maintains it, Chrome-specific features and DevTools Protocol access tend to arrive there first. The Chrome DevTools MCP server is also built on Puppeteer.

Selenium's strength is ecosystem and standards. There is a huge body of answers, training material and enterprise tooling, Selenium IDE for recording, and Grid for distributing sessions. Because it follows W3C WebDriver, the same script can drive several vendors' browsers with very few changes.

Performance and resource use

We are not going to quote benchmark numbers here, because results depend heavily on the target site, the machine and whether you count browser start-up. What can be said from the architectures:

  • Reusing one browser and opening many contexts (Playwright, Puppeteer) avoids paying full browser start-up for every session.
  • Selenium's classic WebDriver model is request/response over HTTP to the driver, which adds a hop per command; WebDriver BiDi adds a WebSocket for events.
  • Blocking images, fonts and media through request routing (page.route() in Playwright, request interception in Puppeteer, BiDi network interception in Selenium) usually saves more bandwidth and time than switching libraries. That matters when you pay per gigabyte for residential traffic.

When each tool still wins

Choose Playwright when

  • You want one API in Node.js, Python, Java or .NET.
  • You need many isolated sessions with different proxies in one process.
  • Your targets are JavaScript-heavy and you want auto-waiting by default.
  • You value built-in debugging: codegen, traces and the inspector.

Choose Puppeteer when

  • Your stack is JavaScript or TypeScript and Chrome is your main target.
  • You want a lighter library with direct DevTools Protocol access.
  • You already have Puppeteer scripts, plugins or Chrome extension tooling. See proxies in Node.js for the HTTP-client side of a JavaScript scraper.

Choose Selenium when

  • Your team writes Java, C# or Ruby, or already maintains Selenium tests.
  • You must automate branded browsers, including Safari.
  • You run, or want, a Selenium Grid to spread sessions across machines.
  • Standards compliance and long-term vendor support matter more than convenience.

Common mistakes when choosing

  • Using a browser when HTTP would do. If the data is in the initial HTML or a JSON endpoint, a plain HTTP client is faster and cheaper than any of these tools.
  • One browser per job. Launching a new browser for every URL wastes memory; reuse browsers and rotate contexts.
  • Hard-coded sleeps. Fixed delays are slow when the page is fast and fail when it is slow. Use auto-waiting locators or explicit waits.
  • Switching libraries to fix blocks. If you are getting 403s or CAPTCHAs, the cause is usually IP reputation, rate or fingerprint consistency. Our guide to avoiding CAPTCHAs when scraping covers the fixes that matter more.
  • Ignoring proxy auth constraints. Check early how your chosen tool handles authenticated proxies, so you are not forced into IP allowlisting late in the project.

Migrating between them

Moving from Puppeteer to Playwright is usually the smoothest path, because the concepts (browser, context, page, locator) map closely and both are JavaScript-first. The main changes are swapping waiting patterns for Playwright locators and moving proxy credentials from page.authenticate() into the context's proxy option.

Moving from Selenium to either is a bigger rewrite: explicit waits become auto-waiting locators, driver-per-session becomes context-per-session, and capabilities become launch and context options. Many teams do it gradually, porting the scrapers that suffer most from flakiness first and leaving stable Selenium jobs alone.

Bottom line

There is no universal winner, but there is a sensible default. Start with Playwright if you are building something new and need sessions, proxies and reliability. Pick Puppeteer if you are firmly in JavaScript and Chrome-focused. Stay with Selenium when your language, your browsers or your existing Grid require it. Whichever you choose, the proxy layer and your request pacing will decide your block rate far more than the library name. If you are choosing proxies for a Playwright setup, see our best proxies for Playwright roundup.

Frequently asked questions

For most new scraping projects Playwright is the more convenient choice, because it supports several languages, gives each browser context its own proxy with credentials, and auto-waits on actionability checks before every action. Puppeteer is still a good fit if you work only in JavaScript, mainly target Chrome and want a lighter library close to the DevTools Protocol.

Yes, in the right situations. Selenium has official bindings for Java, Python, C#, Ruby and JavaScript, drives branded browsers including Safari through vendor drivers, and scales across machines with Selenium Grid. It needs more explicit waiting code than Playwright, so it shines most where a team already has Selenium skills or infrastructure.

None of them is undetectable. All three automate a real browser and can expose automation signals such as navigator.webdriver. Detection depends far more on IP reputation, request rate, headless mode and fingerprint consistency than on which library sends the commands.

Yes. Playwright's documentation states that a proxy can be set globally for the browser or individually for each browser context, with an optional username and password for HTTP(S) proxies. That lets one browser process run several isolated sessions, each through its own proxy session.

Set the proxy server with Chrome's --proxy-server launch argument or the proxyServer option of createBrowserContext, then supply credentials with page.authenticate(). Puppeteer's docs note that authenticate turns on request interception behind the scenes, which can affect performance.

Selenium sets proxies through the standard proxy capability, which has no credential field. With WebDriver BiDi enabled, Selenium documents authentication handlers that can answer Basic or Digest challenges in code; otherwise many teams use IP allowlisting with their proxy provider.

Playwright officially supports TypeScript/JavaScript, Python, Java and .NET. Puppeteer is officially JavaScript/TypeScript only. Selenium has official bindings for Java, Python, C#, Ruby and JavaScript, and its documentation also includes Kotlin examples.

Not always. If the data you need is in the initial HTML or in a JSON endpoint the page calls, a plain HTTP client is faster and cheaper. Use Playwright, Puppeteer or Selenium when content only appears after JavaScript runs or when you must interact with the page.

Found this useful? Share it.