DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

How to Wait for Navigation in Puppeteer Before Taking a Screenshot

Await direct navigation with page.goto(), or register waitForNavigation() before a click. For late-rendered content, wait for the selector that signals the page is ready before capturing.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

For a direct URL, await page.goto() before taking the screenshot. For a click that triggers navigation, start page.waitForNavigation() before the click and await both with Promise.all(). If the screenshot depends on content rendered after navigation, also wait for that content explicitly.

Wait for a direct navigation

Pass a waitUntil condition to page.goto(), await it, then await the screenshot. This follows the ordering shown in the Puppeteer screenshot guide.

As an Amazon Associate I earn from qualifying purchases.

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

page.goto() resolves to the main resource response, but can return null in special cases. If you need to inspect the response, account for that possibility rather than assuming it is always an object. See the Page.goto() API reference.

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

Wait when an action triggers navigation

Register the navigation wait before clicking. Starting it afterward risks missing the event because navigation may begin as soon as the click runs. Puppeteer’s Page documentation recommends awaiting both operations together.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • 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
const [response] = await Promise.all([
  page.waitForNavigation({ waitUntil: 'networkidle2' }),
  page.click('a.my-link'),
]);

await page.screenshot({ path: 'screenshot.png' });

The response is optional for capturing a screenshot; keep it if you need to inspect the main-resource response. A navigation wait can resolve to null for cases such as about:blank or a same-URL hash change. History API URL changes count as navigation, according to the Frame.waitForNavigation() reference.

Choose a navigation completion condition

The waitUntil option accepts one lifecycle event or an array; when you provide an array, Puppeteer waits for all listed events. The documented default is load. The right condition depends on what the screenshot needs, not on a universal fastest or most reliable choice.

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
Condition What it waits for Use it when
domcontentloaded The DOMContentLoaded event. The required DOM is available and later-loading resources do not matter.
load The browser’s load event; this is the documented default. The screenshot should wait for the page’s load event.
networkidle0 No more than zero network connections for at least 500 ms. The page’s network activity can reasonably become idle under that threshold.
networkidle2 No more than two network connections for at least 500 ms. You want the documented two-connection idle threshold.

These network-idle events are lifecycle heuristics, not proof that a single-page application has finished rendering all data or animations. Persistent connections and background requests can also make network-idle waits unsuitable. The definitions are in Puppeteer’s PuppeteerLifeCycleEvent reference.

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

Wait for screenshot-critical content

Navigation completion and application readiness are different things. If the screenshot must include a particular component, wait for a selector that represents that requirement after navigation rather than adding an arbitrary delay.

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.goto(url, { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-testid="report-ready"]', { visible: true });
await page.screenshot({ path: 'report.png' });

Choose a selector that the target page actually exposes. With visible: true, waitForSelector() waits for the element to appear and be visible; without it, the condition is that the selector appears in the DOM. It works across navigations. See the waitForSelector() API reference. Puppeteer also recommends locators for interactions; their documented action preconditions include viewport presence, visibility, enabled state, and a stable bounding box. See Page interactions.

Capture and save the screenshot

Await page.screenshot() after the navigation and any page-specific readiness wait. Supplying path saves the capture to that file; without a path, the method returns screenshot bytes by default. Screenshot options are documented in the Page.screenshot() reference.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • 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
await page.screenshot({ path: 'screenshot.png' });

Timeouts and common failure cases

Puppeteer’s documented default timeout for WaitForOptions is 30,000 ms. You can set a per-call timeout or change the page’s default with its timeout-setting methods; 0 disables the timeout. See the WaitForOptions reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The click happens but the navigation wait times out: Check whether the click actually causes a document or History API navigation. If it only updates content in place, wait for the resulting selector or state instead. For navigation, start the wait before the click and await both with Promise.all().
  • networkidle0 or networkidle2 never completes: The page may keep connections open or continue background requests. Choose another appropriate lifecycle event, then wait for the specific screenshot-critical element.
  • The screenshot is missing late-rendered content: A navigation event does not guarantee app data or animations have finished. Add a meaningful selector or locator readiness condition before capturing.
  • The wait times out before the page is ready: Check whether the chosen event or selector matches the page’s behavior. If necessary, configure a suitable timeout; disabling it with 0 removes the time limit rather than fixing a readiness condition that never occurs.
  • The navigation response is null: Do not assume every completed navigation has a main-resource response. Handle special cases such as about:blank or a same-URL hash navigation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot from a URL without setting up Puppeteer, ScreenshotNeo provides a screenshot API. One GET request returns an image or PDF; see the API documentation.

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response identifies the page verdict and billing status in headers. Its MCP server gives AI agents screenshot, page-info, and PDF-capture tools. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up free for 1,000 screenshots a month, with no card required.

Frequently Asked Questions

Can I use more than one Puppeteer navigation wait condition?

Yes. Pass an array to `waitUntil`; Puppeteer waits for every listed lifecycle event.

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

Does `networkidle2` mean a page has finished all its animations?

No. It is a network-connection threshold, not a guarantee about application rendering or animations.

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

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.