puppeteer / examples

Use case-driven examples for using Puppeteer and headless chrome
https://developers.google.com/web/tools/puppeteer/
Apache License 2.0
2.37k stars 302 forks source link

How to know when the network is idle (not on loading) #24

Closed eduardosada closed 5 years ago

eduardosada commented 5 years ago

Hi @ebidel

Could you tell me why is this line commented?

https://github.com/GoogleChromeLabs/puppeteer-examples/blob/59355609ecb3c2e396a289b28f34d5116fc89b8e/lazyimages_without_scroll_events.js#L97

I would like to know if it's possible to know when the network is idle.

ebidel commented 5 years ago

I think I was experimenting. await page.goto(url, {waitUntil: 'networkidle2'}); should wait for the page to load and network to be idle. For this script, I was seeing some resources lazy loaded well after the page navigation was complete. I wanted to catch those too, hence the additional page.waitFor after the page.goto.