For taking screenshots, Puppeteer and Playwright are about equally fast: in our test of 20 real pages, captured three times in each library and in both of Chrome's headless modes, the median capture took between 0.66 and 0.93 seconds, and the biggest gap, in starting the browser, came from the headless mode rather than the library. The differences that matter are elsewhere. Playwright waits for web fonts before every screenshot and Puppeteer does not, so Puppeteer can save a blank page. Neither library puts a timeout on a screenshot by default, and when a page redirected itself straight after loading, Puppeteer's screenshot sometimes never returned at all.
This article gives the numbers, the failures we hit and the code that avoids them.
How we tested
We captured the same 20 home pages (example.com, MDN, GitHub, python.org, nodejs.org, go.dev, rust-lang.org, w3.org, web.dev, bbc.com, apple.com, microsoft.com, vercel.com, npmjs.com, gnu.org, mozilla.org, cloudflare.com, ietf.org, the WHATWG HTML spec and docs.docker.com) in four setups:
| Setup | Launch call | Browser it ran |
|---|
| Puppeteer, new headless | puppeteer.launch() | Chrome for Testing 156 |
| Puppeteer, shell | puppeteer.launch({ headless: "shell" }) | chrome-headless-shell 156 |
| Playwright, default | chromium.launch() | Chromium headless shell 158 |
| Playwright, chromium channel | chromium.launch({ channel: "chromium" }) | Chromium 158, new headless |
The two headless modes are different programs. Chrome's "new" headless mode is the real browser running without a window. The older mode now ships separately as chrome-headless-shell, which Chrome's team describes as a lightweight wrapper better suited to automated screenshots, and which Puppeteer's guide says is "more performant for automation tasks" but doesn't fully match regular Chrome. Puppeteer uses new headless by default; Playwright uses the shell by default and switches to new headless with the chromium channel.
Each capture opened a fresh page at 1280 × 800, loaded the URL with waitUntil: "load" and a 30-second limit, took a viewport screenshot and then a full-page PNG, and timed each step. We ran three rounds and rotated the order of the setups on every page so none always hit a cold cache. That is 240 capture attempts. We capped every step at 45 seconds, for a reason explained below.
One caveat up front: the two libraries ship different Chrome builds (156 and 158), so a library comparison is also a browser-version comparison. That is what you get when you install each with its defaults.
Speed: closer than the arguments suggest
Medians over the 18 pages that every setup captured in every round (54 captures per setup), in milliseconds:
| Setup | Open page | Load | Viewport shot | Full-page shot | Whole capture |
|---|
| Puppeteer, new headless | 37 | 366 | 100 | 215 | 660 |
| Puppeteer, shell | 57 | 351 | 83 | 199 | 675 |
| Playwright, default (shell) | 58 | 314 | 74 | 226 | 722 |
| Playwright, chromium channel | 102 | 343 | 100 | 257 | 927 |
Page loading dominates, and it depends on the site and the network, not the library. The screenshot calls themselves differ by tens of milliseconds. The only clear gap is launching the browser, which happens once per run:
| Setup | Launch, rounds 1 / 2 / 3 |
|---|
| Puppeteer, new headless | 1,183 / 567 / 652 ms |
| Puppeteer, shell | 135 / 128 / 130 ms |
| Playwright, default (shell) | 255 / 178 / 98 ms |
| Playwright, chromium channel | 602 / 315 / 290 ms |
By the median of the three launches, the shell started five times faster than new headless in Puppeteer (130 against 652 ms) and 1.8 times faster in Playwright (178 against 315 ms). If you launch a browser per screenshot, as some serverless setups do, that matters more than the choice of library. If you keep one browser open and reuse it, it barely matters at all.
The same page is not always the same height
Full-page heights agreed across all four setups on 10 of the 18 pages. Where they differed, the clearest cases split by browser build or headless mode, not by library:
| Page | Puppeteer new / shell | Playwright shell / channel |
|---|
| html.spec.whatwg.org/multipage | 35,834 / 35,834 px | 36,164 / 36,164 px |
| web.dev | 6,787 / 6,990 px | 6,990 / 6,787 px |
| github.com | 7,661 / 7,661 px | 7,596 / 7,596 px |
The HTML spec page and github.com split by Chrome version (156 against 158). web.dev split by headless mode: both shells gave 6,990 pixels and both new-headless browsers gave 6,787. Other pages, such as microsoft.com, w3.org and MDN, changed height between rounds in the same setup, because the pages themselves changed between loads. If you compare screenshots over time, as in visual regression testing, pin the browser build and the headless mode, and expect some pages to vary anyway.
Fonts: Playwright waits, Puppeteer does not
Playwright's screenshot code waits for document.fonts.ready before it captures. You can see it in the 1.65.0 source, which logs "waiting for fonts to load..." first. Puppeteer's page.screenshot() has no such step.
To see the effect, we served a page whose only web font arrives 1.5 seconds late, with font-display: block so the browser hides the text until the font is ready. We screenshotted it straight after DOMContentLoaded and counted the dark pixels:
| Run | Screenshot call took | Dark pixels |
|---|
Puppeteer, page.screenshot() | 929 ms | 0 |
Puppeteer, after await document.fonts.ready | 1,557 ms | 3,630 |
Playwright, page.screenshot() | 1,520 ms | 3,630 |
The plain Puppeteer capture is a blank white image, as the picture at the top of this article shows. One line fixes it:
await page.evaluate(() => document.fonts.ready);
document.fonts.ready only covers fonts the page has already asked for. It does not wait for lazy-loaded images or content that a script adds later; our guide to waiting for the right moment covers those.
Timeouts: a screenshot can wait for ever
Neither library times out a screenshot on its own. Puppeteer's ScreenshotOptions has no timeout option at all. Playwright's has one, but in JavaScript it "Defaults to 0 - no timeout" unless you set actionTimeout or call setDefaultTimeout.
This mattered on bbc.com. From our test machine, bbc.com loads, fires its load event and then, about 200 milliseconds later, sends itself to bbc.co.uk with a script. A screenshot requested in that gap races the navigation. Over the three benchmark rounds:
| Setup | bbc.com captured |
|---|
| Puppeteer, new headless | 0 of 3: hung once, then "Not attached to an active page" twice |
| Puppeteer, shell | 0 of 3: hung every time |
| Playwright, default (shell) | 3 of 3 |
| Playwright, chromium channel | 3 of 3 |
We expected that to make Playwright the clear winner, so we ran the race on its own, five fresh browsers per setup, screenshot straight after load:
| Setup | Succeeded | How the failures looked |
|---|
| Puppeteer, new headless | 4 of 5 | no answer after 30 s |
| Puppeteer, shell | 4 of 5 | no answer after 30 s |
| Playwright, default (shell) | 2 of 5 | "Unable to capture screenshot" after about 0.5 s |
| Playwright, chromium channel | 5 of 5 | none |
So both libraries lose this race some of the time, and the three benchmark rounds were partly luck. The real difference is how they fail: Playwright gave an error in half a second, which you can catch and retry, while Puppeteer's call sat waiting until something outside it gave up. In a screenshot service that would tie up a browser page indefinitely. A traced Puppeteer run showed the page reaching bbc.co.uk 575 ms in, after which the pending screenshot never came back. Our earlier attempt at this benchmark, run without step limits, stalled on exactly this page.
The fix has two parts: let the page finish navigating before you capture, and put a limit on the screenshot. This version captured bbc.co.uk five times out of five:
import puppeteer from "puppeteer";
function withTimeout(promise, ms, label) {
let timer;
const timeout = new Promise((_, reject) => {
timer = setTimeout(() => reject(new Error(`${label} took longer than ${ms} ms`)), ms);
});
return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
}
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto("https://www.bbc.com", { waitUntil: "networkidle2" });
await page.evaluate(() => document.fonts.ready);
await withTimeout(page.screenshot({ path: "bbc.png" }), 15_000, "screenshot");
console.log("captured", page.url());
await browser.close();
Output, run five times:
captured https:
captured https:
captured https:
captured https:
captured https:
networkidle2 waits until there have been no more than two network connections for 500 ms, which in our runs was long enough for the redirect to finish. In Playwright, set the limit once with page.setDefaultTimeout(), which also covers screenshots:
import { chromium } from "playwright";
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
page.setDefaultTimeout(15_000);
await page.goto("https://www.bbc.com", { waitUntil: "networkidle" });
await page.screenshot({ path: "bbc-playwright.png" });
console.log("captured", page.url());
await browser.close();
This one also printed captured https: in all five of our runs.
One more failure in the data had nothing to do with either library: gnu.org timed out on load in 10 of 12 attempts, in all four setups.
The API: Playwright has more screenshot options built in
Both libraries take viewport, full-page, clipped and element screenshots, in PNG, JPEG or WebP. Playwright adds options that Puppeteer leaves to you:
| Need | Puppeteer 25.16 | Playwright 1.65 |
|---|
| Wait for web fonts | do it yourself | built in |
| Stop CSS animations | do it yourself | animations: "disabled" |
| Hide the text cursor | do it yourself | caret: "hide", the default |
| Cover parts of the page | do it yourself | mask: [locators] |
| Extra CSS for one shot | addStyleTag, which stays on the page | style, applied only while capturing |
| Timeout | none | timeout, 0 (none) by default |
Here is the same task in each: a full-page JPEG of go.dev with its header hidden. Puppeteer:
import puppeteer from "puppeteer";
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto("https://go.dev", { waitUntil: "load" });
await page.addStyleTag({ content: "header { visibility: hidden }" });
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: "go-puppeteer.jpg", fullPage: true, type: "jpeg", quality: 80 });
await browser.close();
Playwright:
import { chromium } from "playwright";
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
await page.goto("https://go.dev", { waitUntil: "load" });
await page.screenshot({
path: "go-playwright.jpg",
fullPage: true,
type: "jpeg",
quality: 80,
style: "header { visibility: hidden }",
});
await browser.close();
Both produced a 1280 × 3840 JPEG, of about 384 KB from Puppeteer and 390 KB from Playwright. For more on each library's options, see our guides to Puppeteer full-page screenshots and Playwright screenshots.
Which one to use
- Already using one? Stay with it. Nothing we measured would justify a rewrite.
- Starting fresh and only taking screenshots? Playwright needs less code to get a correct picture, because it handles fonts, animations and the cursor itself. Puppeteer gets the same result with a few extra lines.
- Launching a browser per capture? Use the headless shell in either library: it started 1.8 to 5 times faster.
- Need the capture to match real Chrome? Use new headless (Puppeteer's default, or Playwright's
chromium channel), and pin the version, since our full-page heights changed with both the mode and the Chrome build.
- Either way: put a timeout on every screenshot, wait for fonts, and wait for pages that move themselves after
load.
If you'd rather not run browsers at all, our free screenshot tool and API capture a page from a single request.