question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When to use `networkidle2`?

See original GitHub issue

I’m reading the docs for networkidle2 and understand what it will do but the docs don’t really outline its use or why 2 connections instead of 1 or 5. Basically when should one use this flag?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:41
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

173reactions
aslushnikovcommented, Dec 12, 2017

@armanm I won’t be giving any specific URLs, but a few of the common scenarios are:

  • networkidle0 comes handy for SPAs that load resources with fetch requests.
  • networkidle2 comes handy for pages that do long-polling or any other side activity.

Do you have any concerns about these signals?

14reactions
aslushnikovcommented, Dec 11, 2017

@armanm both networkidle0 and networkidle2 events are heuristics to determine page load state. We picked these since we find them working quite good for a lot of real-world use cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer waitUntil Options - Using them effectively.
networkidle2 is tailored more towards the page that uses streams, or long-lived connections, such as polling or background tasks that involve ...
Read more >
waitUntil - Microlink API
'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2'. Tell the browser to wait until the target website emits one or more event(s) ...
Read more >
Puppeteer wait until page is completely loaded - Stack Overflow
You can use page.waitForNavigation() to wait for the new page to load completely before generating a PDF: await page.goto(fullUrl, ...
Read more >
How to make puppeteer wait for page to load - Urlbox
Another option is to use networkidle2 , which allows no more than 2 active network requests for a window of 500ms.
Read more >
Puppeteer, wait until the page is ready! - ScreenshotOne
While networkidle2 is suitable for applications with open connections and sends requests after the page is loaded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found