Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
browser automation

How to Wait for a Webpage to Fully Load Before Taking a Puppeteer Screenshot

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no universal “fully loaded” event for a modern webpage. Start navigation with Puppeteer’s waitUntil option, then wait for a page-specific signal—such as a ready marker, visible target, or completed application state—before calling page.screenshot(). For a simple document, networkidle2 is a practical starting point; for client-rendered applications, an explicit selector is usually more dependable.

The reliable pattern: navigation, readiness signal, screenshot

A screenshot captures the browser at one instant. The browser may have fired a lifecycle event while JavaScript is still rendering components, loading lazy images, applying fonts, or replacing placeholders with API data. Treat readiness as two separate questions:

  1. Has the initial navigation reached an acceptable milestone?
  2. Has the content that must appear in the image reached its observable ready state?

In code, that normally means page.goto(), an additional wait when needed, and only then page.screenshot().

Simple pages: use network idle during navigation

Puppeteer’s screenshot guide demonstrates this compact form:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();

await page.goto('https://example.com', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'page.png', fullPage: true });

await browser.close();

networkidle2 lets navigation finish after Puppeteer observes no more than two active network connections for the required idle period. It is useful when the page’s important resources arrive during normal loading, but it is still a heuristic rather than a visual-completeness guarantee.

Client-rendered pages: wait for an application signal

If the page renders after an API request, expose a marker when the required work is complete and wait for it:

await page.goto('https://app.example.com/report', {
  waitUntil: 'domcontentloaded'
});

await page.waitForSelector('[data-page-ready="true"]', {
  visible: true,
  timeout: 30000
});

await page.screenshot({ path: 'report.png', fullPage: true });

Replace the selector with a real signal from the site. A marker should be set only after the data, layout, and critical images needed in the capture are ready. Waiting for a generic element such as a header can succeed while the main content is still a skeleton.

Which Puppeteer wait should you choose?

Approach Waits for Best use Important limitation
waitUntil: 'load' The browser’s load lifecycle event Basic pages whose required resources are part of initial loading Does not describe later client rendering, lazy loading, or app data
waitUntil: 'networkidle2' Navigation reaching a network-idle condition Simple pages where brief network quiet is a useful proxy; it is the pattern shown in Puppeteer’s screenshot guide Timers, animations, and later requests can still change pixels
page.waitForNetworkIdle() Network activity meeting configurable idle criteria after navigation A separate quiet period after another navigation milestone Persistent polling, analytics, or streaming requests can prevent or delay completion
page.waitForSelector() or a locator condition A page-specific element or state React, Vue, Angular, and other client-rendered pages with a meaningful ready marker Only as trustworthy as the selector; one element does not prove the whole page is complete

load versus networkidle2

Use load when the screenshot depends on the initial document and its declared resources. Choose networkidle2 when the page normally makes a few short-lived requests and then settles. Neither event knows whether a chart finished animating or whether an application replaced a placeholder.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

networkidle0 versus networkidle2

networkidle0 requires zero active connections, so it can be appropriate for a page that truly becomes quiet. It is often a poor fit for sites with telemetry, long polling, WebSockets, advertisements, or other persistent traffic. networkidle2 tolerates up to two connections and is therefore less likely to wait forever, but it can resolve before late visual work. Pick the condition that matches the target site, then add an app-specific wait when pixels matter.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Configuring page.waitForNetworkIdle()

Puppeteer’s network-idle options document an idleTime default of 500 milliseconds and a concurrency default of 0. You can make the quiet period explicit:

await page.goto(url, { waitUntil: 'domcontentloaded' });
await page.waitForNetworkIdle({ idleTime: 1000, concurrency: 2 });
await page.screenshot({ path: 'settled.png' });

A longer idle period can help pages that issue bursts of requests, but it increases latency and still cannot detect a future timer-driven update. If the page continuously polls, prefer a selector or application state instead.

Wait for the thing you actually need to see

Lazy-loaded images

Full-page capture can include images that load only when they approach the viewport. Scroll the page to trigger those requests, then wait for image completion before capturing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.goto(url, { waitUntil: 'domcontentloaded' });

await page.evaluate(async () => {
  const step = Math.max(window.innerHeight, 500);
  for (let y = 0; y < document.body.scrollHeight; y += step) {
    window.scrollTo(0, y);
    await new Promise(resolve => setTimeout(resolve, 100));
  }
  window.scrollTo(0, 0);
});

await page.waitForFunction(() =>
  [...document.images].every(img => img.complete)
);
await page.screenshot({ path: 'images.png', fullPage: true });

complete means the image request finished (successfully or unsuccessfully); it does not prove every image decoded correctly. For a critical gallery, wait for a site-provided ready marker or inspect the rendered state.

Fonts and layout shifts

Puppeteer documents that PDF generation waits for fonts by default. Its screenshot documentation does not make the same guarantee for page.screenshot(). If typography affects the image, wait for the specific font or visual condition in the page:

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
await page.evaluate(async () => {
  if (document.fonts) await document.fonts.ready;
});
await page.waitForSelector('[data-layout-ready="true"]');
await page.screenshot({ path: 'typed.png' });

The font promise only says the document’s font set has settled; a separate layout marker may still be necessary for charts, ads, or measured components.

Visible and stable targets

Puppeteer locators perform visibility and stability checks for relevant interactions, including a stable bounding box across consecutive animation frames. That is useful when capturing one element:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const card = page.locator('[data-testid="invoice-card"]');
await card.wait();
await card.screenshot({ path: 'invoice-card.png' });

This verifies the target’s condition, not the readiness of every other element in a full-page screenshot. Combine it with a page-level ready state when the whole document matters.

A production-ready helper with timeouts and diagnostics

Make readiness failures visible instead of silently taking a partial image:

async function screenshotWhenReady(page, url, output) {
  try {
    await page.goto(url, {
      waitUntil: 'domcontentloaded',
      timeout: 45000
    });
    await page.waitForSelector('[data-page-ready="true"]', {
      visible: true,
      timeout: 30000
    });
    await page.screenshot({ path: output, fullPage: true });
  } catch (error) {
    console.error(`Readiness check failed for ${url}:`, error);
    await page.screenshot({ path: `${output}.debug.png`, fullPage: true });
    throw error;
  }
}

const browser = await puppeteer.launch();
const page = await browser.newPage();
await screenshotWhenReady(page, 'https://example.com/dashboard', 'dashboard.png');
await browser.close();

Use a selector that the application controls. Avoid an unbounded delay: a fixed sleep can hide regressions, wastes time on fast runs, and still misses slower runs. If a known animation is the only remaining change, a short, bounded delay can supplement—not replace—a meaningful condition.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Troubleshooting incomplete or blank screenshots

The screenshot is blank

  • Cause: navigation failed, a bot check blocked the page, or the capture ran before the app mounted.
  • Fix: catch navigation errors, inspect the response and page URL, increase the navigation timeout only when the site is genuinely slow, and wait for an application marker after navigation.

The main content is missing

  • Cause: content arrives through XHR/fetch after load.
  • Fix: use domcontentloaded followed by waitForSelector() or a locator for the completed component.

The run never reaches network idle

  • Cause: polling, analytics, streaming, or an open connection keeps the page active.
  • Fix: stop relying on networkidle0; use networkidle2 with a bounded timeout or, preferably, an app-specific ready state.

Images are absent in a full-page capture

  • Cause: lazy loading has not been triggered or image requests are still pending.
  • Fix: scroll to load deferred content, wait for relevant images or a gallery-ready marker, and then capture.

Text uses fallback fonts or shifts after capture

  • Cause: screenshot capture has no documented font-wait guarantee equivalent to PDF generation.
  • Fix: await document.fonts.ready and a page-specific layout condition before taking the image.

Timeouts appear intermittently

  • Cause: variable server latency, third-party resources, or a selector that is not emitted on every state.
  • Fix: record console and request failures, verify the selector in all legitimate page states, and distinguish a failed readiness check from a successful but empty page.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

Every additional wait increases capture latency. A practical order is: use the earliest navigation milestone that is safe, wait only for the resources represented in the image, and avoid waiting for unrelated background traffic. Reusing a browser process can reduce launch overhead, while creating a fresh page per job limits state leakage. Set explicit navigation and selector timeouts, log which condition completed, and retain a diagnostic screenshot on failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For repeatable output, control viewport size, device scale factor, timezone, locale, cookies, and authentication. Disable or hide volatile widgets when they are not part of the subject. If the page changes continuously, no generic idle setting can make every run identical; capture a documented application state instead.

Or skip the browser setup

ScreenshotNeo is a hosted screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be switched off. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response reports the result through X-Page-Verdict and X-Billed headers.

For a one-call image, see the ScreenshotNeo API documentation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in Python:

import requests
r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)

And Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
const buffer = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', buffer));

ScreenshotNeo also provides waits for a selector, delay, or network idle; full-page and element captures; lazy-image loading; custom CSS and JavaScript; clicks; hidden selectors; device presets and arbitrary viewports; retina scale; dark mode; PDF output; request blocking; headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to try the API without a card.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

FAQ

Does networkidle2 guarantee a complete screenshot?

No. It describes network activity during navigation, not every later render, timer, animation, or user-triggered update. Add a page-specific readiness condition when those pixels matter.

Should I use a fixed five-second delay?

No universal delay guarantees completion. A bounded delay can accommodate a known animation, but an observable selector or application state is more reliable and usually faster.

Can a locator prove the entire page is ready?

No. Locator checks concern the selected element’s visibility and stability. A full-page capture needs a page-level condition as well.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why can a PDF look correct when a screenshot does not?

Puppeteer documents a default font wait for PDF generation, while the screenshot reference does not provide the same documented guarantee. Explicitly wait for fonts and layout before screenshots.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.