logo of Screenshot for Web
Free toolsPlaygroundDocsBlogPricing
LoginDashboard

Company

HomeFeaturesPricingBlogFacts

Screenshot Tools

Website ScreenshotsFull Page ScreenshotsScrolling ScreenshotsWebsite HistoryPDF Generation APIScreenshot API

Legal

Terms of UsePrivacy PolicyCookie PolicyCopyrightSecurity

Support

FAQSupportContact UsAPI Status
screen shot for web logo

No clutter. No distractions. Just clean, full-page screenshots with smart customization.

© 2026 HYDRANODE LTD. All rights reserved.

Screenshot for Web is operated by HYDRANODE LTD, a company registered in England and Wales, company number 15672526. Registered office: 124 City Road, London, London, England, EC1V 2NX.

FacebookInstagramLinkedInYouTube
  1. Home
  2. Blog
  3. Guides

When to take a Puppeteer screenshot: load, networkidle, selectors and fonts, tested

We captured a page that loads in stages at each Puppeteer wait condition: what each one caught, what it missed, and a tested helper that waits for the content.

Screenshot for Web·October 25, 2026·8 min read

Sources

  1. Puppeteer API: PuppeteerLifeCycleEvent (load, domcontentloaded, networkidle0, networkidle2)
  2. Puppeteer API: WaitForOptions (waitUntil and timeout defaults)
  3. Puppeteer API: WaitForNetworkIdleOptions
  4. Puppeteer API: Page.waitForSelector()
  5. MDN: Window load event
  6. MDN: Document DOMContentLoaded event
  7. MDN: FontFaceSet.ready
  8. MDN: Document.getAnimations()
  9. MDN: HTMLImageElement.complete

How this article was made

Researched and drafted with AI assistance from the sources listed. All code was run by us on 25 October 2026 on an Apple M5 Mac with Puppeteer 25.16.0 and the Chrome it downloads (Chrome for Testing 156.0.8078.47). The test page and the server that delays its parts were written for this article. The staged-page timings are from three runs each, and the five real sites were each loaded twice per wait condition. Every number, image and output in the article comes from those runs.

Capture any page without ads, banners or chat widgets, free and without an account.

Try the free tools

More articles

  • News

    Puppeteer 25.19 stops print and dark mode emulation from cancelling each other

    Before Puppeteer 25.19.0, emulateMediaType and emulateMediaFeatures reset each other, losing print or dark mode. Our tests, the fix and a workaround.

    November 26, 2026
  • News

    Chrome 158 drops XSLT: what it does to screenshots of sitemaps and feeds

    We captured eight live sitemaps in Chrome 156 and Chromium 158. Styled pages turn into raw XML, a red warning bar is already in captures, and two fixes work.

    November 9, 2026
  • Research

    Chrome DevTools' full-size screenshot: where it fails on long and lazy pages

    We ran DevTools' full-size screenshot on six long pages: it stops at 16,384 pixels and misses content that appears on scroll. Here's why, and the fixes that worked.

    November 8, 2026

A screenshot taken too early shows a spinner, a fallback font or a half-faded card. One taken with the wrong wait condition can take 20 seconds or time out. We built a test page that loads in stages, captured it once for each of Puppeteer's wait conditions, and recorded what each image actually showed.

The short version: load, networkidle2 and a fixed one-second sleep all captured "Loading products…" instead of the products. networkidle0 captured the finished page, but took 20.8 seconds because a chat-style long poll held a connection open. With the poll held open for 60 seconds it failed with a TimeoutError. waitForSelector alone fired while the product images were still missing and the cards were mid-fade. What worked was waiting for the content itself and then for its images, fonts and animations. The helper that does this is below, with the edge cases we tested it on.

What each wait condition means

page.goto() resolves when the condition in waitUntil is met. Puppeteer's documentation defines four:

ConditionResolves when
domcontentloadedThe DOMContentLoaded event fires: the HTML is parsed and deferred scripts have run. It doesn't wait for images, subframes or async scripts.
load (the default)The load event fires: stylesheets, scripts, iframes and images have loaded, except lazily loaded ones.
networkidle2There have been no more than 2 network connections for at least 500 ms.
networkidle0There have been no network connections for at least 500 ms.

The default timeout is 30,000 ms, and waitUntil also accepts an array, in which case all the listed events must fire. None of these conditions knows anything about your page. A request fired by JavaScript after the load event isn't covered by load, and two slow requests are invisible to networkidle2.

The test page

We wrote a small Node server that delays each part of a shop page by a set amount, so every run loads the same way:

PartArrives after
HTML, with a "Loading products…" placeholderat once
Stylesheet300 ms
Hero image ("Autumn sale")400 ms
Web font for the headings (JetBrains Mono, font-display: swap)600 ms
Products API, fetched by a script once the HTML arrives2,000 ms
Six product images, added when the API answers900 ms each
A long poll, like a chat widget'sheld open for 20 s

The product cards fade in over 800 ms. A small "Chat" badge pulses for ever. Each capture used a new browser context and a 1000 × 560 viewport, and we timed from just before page.goto() to the end of the wait.

What each condition captured

We ran every strategy three times. All three runs of each strategy captured the same state, and the timings varied by less than 30 ms.

StrategyTime (median)Product cardsImages loadedWeb fontResult
domcontentloaded0.33 s00 of 1noPlaceholder, fallback font, no hero
load0.93 s01 of 1yesPlaceholder
load + 1 s sleep1.93 s01 of 1yesPlaceholder
networkidle21.45 s01 of 1yesPlaceholder
networkidle020.83 s67 of 7yesComplete, 19 s late
waitForSelector('.card')2.32 s61 of 7yesCards invisible, no images
waitForPageReady('.card')4.14 s67 of 7yesComplete

The test page captured at the load event, 0.93 seconds after navigation: the heading in the web font, the Autumn sale banner, and the text Loading products where the product grid should be.

load caught the font, not the products. We also checked whether the load event waits for a web font. On this page it did: in a separate probe, the navigation's loadEventStart was 927 ms and the font finished at 926 ms. When we slowed the font to 2.5 seconds, the load event moved to about 4.1 seconds. By then the products had arrived and their images were loading, so load produced a complete screenshot by accident. A faster font would have broken it. Whether load happens to cover content fetched by JavaScript depends on a race you don't control.

A fixed sleep is a guess. One extra second after load still showed the placeholder. A longer sleep would have worked here and failed on a slower day.

networkidle2 is fooled by two slow requests. From about 0.9 seconds on, only the products API call and the long poll were open. That is two connections, which networkidle2 allows, so it resolved 500 ms later with the placeholder still on screen.

networkidle0 waited for the chat widget. It waited until the long poll closed at 20 seconds, then 500 ms more. When we held the poll open for 60 seconds, goto failed with TimeoutError: Navigation timeout of 30000 ms exceeded after 30,003 ms. Any page with an open WebSocket, server-sent events or a long poll can do this. One more thing we hit while building the test: in an early version the page never read the long poll's response body. Puppeteer then never saw that request finish. In a check with a 40-second timeout, networkidle0 timed out, although our server's log shows it closed the response after 20 seconds. Reading the body, as real long-poll code does, fixed it.

The test page captured as soon as waitForSelector found a product card, 2.32 seconds after navigation: six card outlines and product names so faint they are barely visible, with no product images.

waitForSelector fires too early for a screenshot. It returns as soon as the element is in the DOM. At that moment, 1 of 7 images had loaded and the first card's computed opacity was 0, at the very start of its fade-in. The visible: true option doesn't help here: Puppeteer's documentation defines visible as not display: none and not visibility: hidden, and a card at opacity 0 is neither.

A helper that waits for the page to be ready

The strategy that worked waits for the content you want, then for the three things that still change how it looks: images, fonts and animations.

// ready.js
async function waitForPageReady(page, selector, { timeout = 30000 } = {}) {
  // 1. The content you came for is in the DOM and visible.
  await page.waitForSelector(selector, { visible: true, timeout });
  // 2. Every image has loaded or failed. Lazy images below the fold are skipped:
  //    they don't start loading until they are scrolled into view.
  await page.waitForFunction(
    () =>
      [...document.images].every(
        (img) =>
          img.complete ||
          (img.loading === "lazy" && img.getBoundingClientRect().top >= window.innerHeight),
      ),
    { timeout },
  );
  // 3. Web fonts have loaded and layout has settled.
  await page.evaluate(() => document.fonts.ready.then(() => true));
  // 4. Finite animations (fade-ins, slide-ins) have finished; endless ones are skipped.
  await page.evaluate(() =>
    Promise.all(
      document
        .getAnimations()
        .filter((a) => a.effect?.getComputedTiming().endTime !== Infinity)
        .map((a) => a.finished),
    ).then(() => true),
  );
}

module.exports = { waitForPageReady };

Use it after a quick navigation:

const puppeteer = require("puppeteer");
const { waitForPageReady } = require("./ready");

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setViewport({ width: 1000, height: 560 });
  await page.goto("http://localhost:8737/", { waitUntil: "domcontentloaded" });
  await waitForPageReady(page, ".card");
  await page.screenshot({ path: "shop.png" });
  await browser.close();
})();

What each step relies on:

  1. The selector should name something that only exists once the data has arrived: a product card, a table row or a chart's SVG. A container that exists in the initial HTML doesn't tell you anything.
  2. img.complete is true once an image has been fully fetched, and also when it failed to load, so a broken image won't hang the wait. It is false for a loading="lazy" image that hasn't started. We checked that in Chrome 156: an off-screen lazy image reported complete = false until we scrolled it into view, then true. Without the lazy-image exception, the helper would time out on any page with lazy images below the fold. With it, the helper finished in 3.8 seconds on our test page with such an image added. For full-page captures, scroll the page first so those images load; our guide to blank images in full-page screenshots covers that.
  3. document.fonts.ready resolves once the document has finished loading fonts, layout is done, and no further font loads are needed.
  4. document.getAnimations() returns CSS animations, CSS transitions and Web Animations. Waiting on every finished promise without the filter never ends if anything loops: on our page the pulsing badge kept that promise pending until we gave up after 10 seconds. An animation that repeats for ever has an end time of Infinity, which is what the filter skips.

How long networkidle costs on real sites

On our test page networkidle0 took 20 seconds. Most sites don't hold connections open like that, so we timed the four waitUntil conditions on five real pages, each in a fresh browser context, twice. These are separate navigations, so in some runs domcontentloaded came in later than load from another run.

Pagedomcontentloadedloadnetworkidle2networkidle0
github.com303–415 ms346–357 ms1,230–1,262 ms1,535–1,631 ms
developer.mozilla.org/en-US/69–82 ms103–120 ms997–999 ms1,100–1,430 ms
react.dev159–258 ms200–252 ms757–902 ms881–962 ms
bbc.com/news174–212 ms202–211 ms1,261–1,346 ms1,417–1,456 ms
theguardian.com/uk87–104 ms227–238 ms889–997 ms998–1,000 ms

None of the ten networkidle0 navigations timed out, and each took about 0.6 to 1.3 seconds longer than load. Part of that is built in: both network-idle conditions need 500 ms of quiet before they resolve. On ordinary pages networkidle0 is a cheap safety margin. It still can't tell you that the content you care about is on screen, and on a page with a socket that never closes it never resolves.

Choosing a wait condition

  • For your own app or a page you know: use domcontentloaded, then wait for a selector that proves the data is there, then for images, fonts and animations, as the helper does. It was the only strategy that was both complete and fast on our test page.
  • For arbitrary URLs, where you can't name a selector: networkidle0 with an explicit timeout, and a fallback that still takes the screenshot if the timeout fires, is a reasonable default. Expect pages with chat widgets or live feeds to hit that timeout.
  • Avoid fixed sleeps. They are always either too long or too short.

If you capture through an API instead of running Chrome yourself, look for the same two settings. Our screenshot API takes waitUntil with the four values above, and waitFor, a selector to wait for before capturing.

How we tested

The server, the test page, the capture script, the probes and the logs are all ours, written for this article. Everything ran on 25 October 2026 with Puppeteer 25.16.0, the latest release on npm that day, and the Chrome for Testing build it downloads, 156.0.8078.47. The server ran on the same machine as the browser, so the delays are the server's own and not network noise. The real-site timings were taken from the same machine the same morning. Treat them as a comparison between conditions rather than as the sites' general speed.