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 DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

How to Wait for Network Idle in Puppeteer

Puppeteer supports network-idle waits during navigation and through page.waitForNetworkIdle(). Choose the condition that matches your task, and avoid treating network quiet as proof that a specific UI state is ready.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use await page.waitForNetworkIdle() to wait for Puppeteer’s direct network-idle condition, or pass waitUntil: 'networkidle2' to page.goto() when the condition should be part of navigation. The direct method lets you set how many concurrent connections may remain and how long traffic must stay quiet; neither approach proves that a particular page element or application task is ready.

Choose the wait that matches the task

Puppeteer 25.12.0 documents two related ways to wait for network activity to settle. Use a navigation lifecycle condition when you want page.goto() to wait as part of loading a URL. Use page.waitForNetworkIdle() when you want a separate wait, or need to tune its connection threshold or quiet interval.

As an Amazon Associate I earn from qualifying purchases.

Option What it waits for Use it when
networkidle0 No more than zero connections for at least 500 ms. Navigation should meet the zero-connection lifecycle threshold.
networkidle2 No more than two connections for at least 500 ms. Navigation may proceed with up to two connections remaining. Puppeteer’s screenshot guide uses this condition.
page.waitForNetworkIdle(options) A direct wait with configurable concurrency and idleTime; the documented defaults are 0 and 500 ms. You need to wait separately from navigation or configure the quiet-period criteria.
Locator or application-specific condition A particular element or action state, rather than general network activity. The task depends on a specific UI state being present, visible, or actionable.

The lifecycle conditions and direct method have separate API definitions; do not assume they are interchangeable in every detail.

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

Wait for network idle during navigation

Pass networkidle2 as the navigation lifecycle condition when opening the page:

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

Use networkidle0 instead if navigation should wait until the lifecycle definition allows zero active connections for at least 500 ms. These thresholds describe the network-idle condition, not whether the page’s content is correct or every script has completed its application-specific work.

Wait separately with page.waitForNetworkIdle()

After navigation or another action, call the direct method. With no options, Puppeteer documents a concurrency default of 0 and an idleTime default of 500 milliseconds:

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
await page.waitForNetworkIdle();

The method returns a Promise<void> and waits at least the configured idle interval.

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

Set the quiet interval and connection threshold

For example, this waits for a one-second quiet interval while allowing up to two concurrent connections under the direct method’s threshold:

await page.waitForNetworkIdle({
  concurrency: 2,
  idleTime: 1_000,
  timeout: 30_000,
});

The values 2 and 1_000 are example choices, not a general recommendation. Set them to fit the page and the condition your workflow needs. The shared wait options have a documented 30,000 ms default timeout; set a different timeout, use page timeout settings, or pass 0 to disable the timeout. A wait can also be canceled with an AbortSignal.

When network idle is the wrong condition

Network quiet is useful when the workflow actually depends on network activity settling. It is not a guarantee that an application-specific task has finished: a page can become quiet before the state you need appears, or ongoing background traffic can prevent the quiet threshold from being reached.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

If the next step requires a particular control to be available, wait for that element or use a locator action that waits for its relevant preconditions. Puppeteer’s interaction guidance describes locators as automatically waiting for elements and relevant action preconditions. This expresses a UI-readiness requirement more directly than waiting for general network inactivity.

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.

Troubleshoot waits that do not resolve

The wait times out

The direct method’s shared wait options use a 30-second timeout by default. A page with continuing requests may never meet the selected idle threshold before that deadline. Choose a timeout appropriate to the workflow, and reconsider whether network quiet is the state you actually need. Disabling the timeout with timeout: 0 removes the deadline; it does not make a page become idle.

The page is quiet, but the expected content is missing

Network-idle completion only describes the network condition. If you need a specific result, wait for the relevant element or application state rather than treating an idle network as proof that the result is ready.

Navigation waits differently from a later direct wait

waitUntil: 'networkidle2' is a lifecycle condition attached to navigation; page.waitForNetworkIdle() is a separate API with configurable options. Choose based on when the wait belongs in the flow, and configure the direct wait explicitly if you need its threshold or quiet interval to differ from its defaults.

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 your goal is a website screenshot rather than browser automation, ScreenshotNeo can return an image or PDF from one GET request. Its capture flow accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status in headers. It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.

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

cURL example, using ScreenshotNeo’s 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

ScreenshotNeo offers 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000 screenshots. Learn about ScreenshotNeo or sign up for the free plan.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.