ivinco
Playwright vs Selenium vs Puppeteer: Scraping at Scale

Playwright vs Selenium vs Puppeteer: Scraping at Scale

Ivinco Team··Updated

Playwright vs. Selenium vs. Puppeteer, in one paragraph: for a new scraping project, Playwright is the default. It has official Python, Node.js, Java and .NET APIs, native async, auto-waiting and the most actively developed stealth forks. Puppeteer is a good choice for Node.js-only teams with existing Chromium code. Selenium still earns its place when you need Selenium Grid to rotate Chrome, Firefox and Edge, or when you already run it.

The rest of this post explains why, and it starts from a different place than most comparisons. Most headless browser comparisons were tested on localhost against a site with no anti-bot protection.

That's not scraping. That's a demo.

Production scraping can mean dozens or hundreds of concurrent browser instances hitting targets defended by Cloudflare or DataDome, around the clock. At that scale, the difference between frameworks isn't API ergonomics. It's the per-instance overhead multiplied by your concurrency target. We call this the Pod Tax: the compounding infrastructure cost each framework imposes when you go from one browser to one hundred.

Language narrows the choice first. In the State of Web Scraping Report 2026 by Apify and The Web Scraping Club, 71.7% of respondents use Python and 17% JavaScript. The real filtering happens when you price out a cluster.

The Comparison Nobody Runs

Most comparison articles test three things: how fast the framework launches a browser, how the selector API feels, and whether it can take a screenshot. Useful for choosing a testing framework. Useless for choosing a scraping framework.

In production, the questions that matter are different:

  • How much memory does each browser instance consume under sustained load?
  • What happens when you run 100 of them in a Kubernetes namespace?
  • Which stealth ecosystem keeps up with modern anti-bot systems?
  • How fast can a new pod start when the autoscaler fires?
  • What happens when a target blocks the tool's default fingerprint?

These questions need measurements on your own targets, not toy benchmarks.

Resource Consumption: Where the Pod Tax Lives

The Pod Tax shows up in three places: memory per instance, Docker image size (which affects cold-start time), and CPU while rendering.

Memory per headless instance

The browser dominates memory use whichever library drives it, and the real number depends on the pages you load. What differs is what each framework adds on top of Chromium:

  • Puppeteer is a thin client for the Chrome DevTools Protocol (CDP), with no extra server process.
  • Playwright's Python, Java and .NET libraries drive the browser through a bundled Node.js driver process.
  • Selenium adds ChromeDriver, a separate driver process that translates WebDriver commands for the browser, with its own memory footprint on top of the browser. The Selenium team describes this model in its components overview.

Measure on your own targets with docker stats before sizing a cluster. An extra 50 MB per instance is nothing at one browser and 5 GB at a hundred: the difference between fitting on one node and needing two.

Docker image sizes

Playwright's official Docker image ships with Chromium, Firefox and WebKit. That's useful for cross-browser testing and unnecessary weight for scraping; installing only Chromium (playwright install chromium) on a slim base image cuts it substantially. Selenium's standalone images are well optimized but less flexible for custom configurations. Check current sizes before you choose, because they change with every browser release.

Image size matters because Kubernetes pulls images on cold starts. On a 1 Gbps network, every extra gigabyte adds about eight seconds of transfer before decompression even starts, and slower or shared registries make it worse. When the horizontal pod autoscaler fires because queue depth spiked, those seconds mean missed pages.

CPU during rendering

All three frameworks consume similar CPU during page rendering, because Chromium does the heavy lifting regardless of which library called it. The difference is the overhead between actions. Playwright's auto-wait polls the DOM between steps, trading a little CPU for eliminating the manual retry loops that dominate poorly written Puppeteer scripts.

Selenium pays the most between actions. Each command round-trips through ChromeDriver's HTTP server. That's fast enough for a navigate-wait-extract loop, but on a workflow clicking through 50 pagination buttons, the round-trips add up to seconds of overhead that Playwright and Puppeteer don't have.

The Stealth Ecosystem in 2026

None of these frameworks is undetectable out of the box. Anti-bot systems look for automation signals in the browser, its fingerprint and its behavior. Our post on browser fingerprinting covers how that detection works; here is what matters for choosing a framework.

What gets detected

For years, a primary detection vector for Puppeteer and Playwright was the Runtime.Enable CDP command they send during initialization. The rebrowser-patches project documents how anti-bot software, naming Cloudflare and DataDome, used it as a sign of automation. The best-known check for it stopped working after V8 changes in May 2025, but default setups still leak other signals: navigator.webdriver, inconsistent fingerprints, machine-like behavior and TLS.

Selenium has its own signal: ChromeDriver injects $cdc_ variables into the page's JavaScript context, which are trivially detectable. Undetected-chromedriver patches the ChromeDriver binary to remove them.

Stealth tools by framework (October 2026)

Selenium:

  • undetected-chromedriver patches ChromeDriver at runtime to remove its most obvious traces. Its last release was in February 2024; nodriver, from the same developer, is its successor and drops WebDriver to connect to Chrome over CDP.
  • SeleniumBase UC Mode builds on undetected-chromedriver and adds tooling around it.

Puppeteer:

  • puppeteer-extra-plugin-stealth patches page-level signals. Its last release was in March 2023.
  • rebrowser-puppeteer is Puppeteer with rebrowser-patches applied. It has had no release since May 2025, while Puppeteer itself has moved on to version 25.

Playwright:

  • playwright-extra with the stealth plugin (Node.js only) uses the same approach as the Puppeteer stealth plugin. Its last release was in March 2023.
  • patchright is a patched Playwright for Python and Node.js. It runs scripts in isolated execution contexts and removes automation flags. Its README lists Cloudflare, Kasada, Akamai and DataDome among the systems it passes; that is the project's own claim.
  • Camoufox is a Firefox build that generates a consistent device fingerprint on every launch and is driven through Playwright's API. Its own README warns it "may not be suitable for stable production use."

The Stealth Snapshot Problem

Any stealth comparison is a snapshot, not a verdict. Anti-bot vendors such as DataDome also score behavior: mouse movement, scroll velocity, typing cadence, click coordinates. Even with a perfect browser fingerprint, machine-like behavior triggers detection, and a vendor update can break a stealth tool overnight.

Choose the framework whose stealth ecosystem is actively maintained, because it will need patching. Today the most active patched fork is patchright, for Playwright. Getting around bot protection can also carry legal risk; see our guide to whether web scraping is legal.

Language and Ecosystem

Scraping teams mostly write Python: 71.7% of respondents in the Apify and Web Scraping Club survey, with JavaScript at 17%.

FeaturePlaywrightPuppeteerSelenium
PythonYes (official)NoYes (official)
Node.jsYes (official)Yes (official)Yes (official)
JavaYes (official)NoYes (official)
.NETYes (official)NoYes (official)
Async PythonYes (native)N/ANo (sync only)
Crawler integrationCrawlee (Node and Python), Scrapy via scrapy-playwrightCrawlee (Node)Scrapy via scrapy-selenium (last release 2019)

Playwright is the only framework with official, first-party support across all four major languages plus native async Python. For teams that prototype in Python and ship in TypeScript, Playwright's API is the same across both: same method names, same patterns.

Selenium's Python API works but is synchronous. For scraping workloads that manage many concurrent sessions, this means threading or multiprocessing instead of asyncio. It works, but the code is harder to debug and the overhead is higher.

Puppeteer's Node.js-only limitation is a growing problem as Python dominates scraping. Teams that hire Python data engineers don't want to maintain a Node.js scraping service.

Kubernetes Deployment Patterns

This is where the framework choice has the most direct infrastructure impact.

Playwright in Kubernetes

Playwright's Docker images ship with bundled browser binaries, so there is nothing to pull at runtime. The deployment pattern: a Deployment with resource requests pinned to measured usage, a Horizontal Pod Autoscaler watching a queue depth metric (Redis, for example), and shared memory sized for Chromium.

Playwright and Puppeteer already pass --disable-dev-shm-usage to Chromium. Playwright still recommends --ipc=host in Docker; in Kubernetes, mount a memory-backed emptyDir at /dev/shm.

Puppeteer in Kubernetes

Same pattern as Playwright for Chromium workloads, with a slightly smaller image. Browserless offers a managed headless Chrome service that speaks Puppeteer's CDP protocol, so teams can offload browser management entirely by pointing Puppeteer at a remote WebSocket endpoint instead of launching local browsers.

Selenium Grid on Kubernetes

Selenium Grid runs on Kubernetes through the official Helm chart, which deploys the Grid with separate Chrome, Firefox and Edge node pools and scales browser nodes up and down with KEDA based on the session queue. The Grid handles session routing, queue management and node health checks.

Grid's strength is multi-browser orchestration. If targets fingerprint the browser type and you need to rotate between Chrome, Firefox and Edge, Grid handles it natively. No other framework has equivalent built-in session routing across browser types.

The trade-off is architectural: the router adds a hop that increases latency and needs a high-availability setup to avoid a single point of failure. Playwright achieves the same multi-browser coverage by launching different browser types in separate pods, but you build the routing logic yourself.

The "Starved Pods" Problem

The failure mode that catches teams scaling headless browsers in Kubernetes is resource starvation. When CPU or memory limits are set too tight, headless Chromium doesn't crash cleanly; it degrades. Pages load partially. JavaScript execution stalls. Navigation timeouts cascade. The scraper produces garbage data without throwing errors.

Set resource requests to observed P95 usage, not averages. Run dedicated node pools for browser workloads. And make the readiness probe load a real test page, verifying that the browser actually renders, not just that the process is running.

The Decision Matrix

Only one of these is a clean default. The other two are situational.

No JavaScript rendering required? Skip the headless browser. curl_cffi with browser TLS impersonation handles HTTP requests at a fraction of a browser's memory. If the data is in the initial HTML response, the Pod Tax drops to near zero.

New Python project, no legacy constraints? Playwright. Native async, auto-wait, multi-browser, and the most active stealth forks (patchright, Camoufox). Python's dominance in scraping makes it the default for a reason.

Existing Puppeteer code in a Node.js stack is a different calculation. The migration cost to Playwright is real and the per-instance difference is small. Keep working extraction logic, and consider Browserless for managed browser infrastructure. If you need a maintained stealth fork, that is patchright, which means Playwright's API: rebrowser-puppeteer has had no release since May 2025.

Selenium Grid still earns its place when you need multi-browser rotation across Chrome, Firefox and Edge. The Kubernetes Helm chart is mature, and Grid handles session routing you'd have to build yourself on Playwright. Migrate only when Grid's maintenance overhead or Selenium's detection rate forces the question.

What This Comparison Cannot Tell You

Whether a specific framework will get past a specific target's anti-bot system next month. Cloudflare, DataDome and HUMAN (formerly PerimeterX) update their detection continuously. The Playwright script that works today may be blocked tomorrow, not because of a framework flaw, but because the target moved to a stricter protection tier.

The framework determines your Pod Tax, your language options and your stealth ecosystem. The proxy infrastructure, TLS fingerprint and behavioral pattern determine whether you get through.

When a scraping pipeline breaks, the framework is the last thing you change. The Pod Tax is the first thing you should have calculated.


Need help scaling headless browsers in production? See our web scraping services. The first conversation is free, and you see a free data sample before the price.

Frequently Asked Questions

Which is better for web scraping, Playwright or Selenium?

For a new project, Playwright. It supports Python, Node.js, Java and .NET with native async in Python, waits for elements automatically, and has the most active stealth forks. Selenium is the better choice when you need Selenium Grid's built-in rotation across Chrome, Firefox and Edge, or when you already run Selenium in production.

Playwright vs. Puppeteer: which is better for scraping?

Playwright, unless your team is Node.js-only with working Puppeteer code. Puppeteer drives Chrome and, since version 23, Firefox from JavaScript; Playwright covers Chromium, Firefox and WebKit from four languages with one API. Its most active stealth fork, patchright, is also on the Playwright side: rebrowser-puppeteer has had no release since May 2025.

How fast is Playwright compared to Selenium?

Playwright is usually faster per action. It keeps a persistent connection to the browser and waits for elements automatically, while Selenium sends each command as a separate HTTP request through a browser driver. Page rendering itself costs about the same in both, since the browser does that work, so the gap shows on interaction-heavy workflows.

Is Selenium the same as Playwright?

No. Both automate real browsers, but Selenium drives them through the W3C WebDriver protocol and a separate driver per browser. Playwright, released by Microsoft on January 31, 2020, ships its own browser builds and controls Chromium, Firefox and WebKit through a single API with auto-waiting. Selenium is older and has the larger ecosystem; Playwright is faster to write and run.

How much memory does a headless browser use per instance?

It depends mostly on the pages: the browser itself dominates. The frameworks differ in what they add on top: Puppeteer adds the least, Playwright adds a driver process in Python, Java and .NET, and Selenium adds ChromeDriver. Measure with docker stats on your real targets before sizing a cluster.

Can Playwright, Puppeteer, or Selenium bypass Cloudflare?

Not out of the box. All three leak automation signals that anti-bot systems look for: navigator.webdriver, fingerprint inconsistencies, machine-like behavior and, for Selenium, ChromeDriver's $cdc_ variables. Patched forks such as patchright remove some of them, and how well they work changes as Cloudflare updates its detection. Getting around bot protection can also carry legal risk.

How do you deploy Playwright on Kubernetes?

Use Playwright's official Docker images with bundled browsers. Set resource requests from measured usage. Playwright already passes --disable-dev-shm-usage to Chromium; for more shared memory, mount a memory-backed emptyDir at /dev/shm. Use a Horizontal Pod Autoscaler watching queue depth to scale browser pods dynamically.

Is Selenium still relevant for web scraping in 2026?

Yes, for teams that need multi-browser rotation (Chrome, Firefox, Edge) through Selenium Grid's native orchestration, with an official Helm chart for Kubernetes. Selenium carries more per-instance overhead and a weaker stealth ecosystem, so for new projects without existing Selenium infrastructure, Playwright is the stronger choice.