When to use `networkidle2`?
See original GitHub issueI’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:
- Created 6 years ago
- Reactions:41
- Comments:13 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 withfetch
requests.networkidle2
comes handy for pages that do long-polling or any other side activity.Do you have any concerns about these signals?
@armanm both
networkidle0
andnetworkidle2
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.