How to make puppeteer wait for the page to load completely?


  1. Posts : 43
    Windows 11
       #1

    How to make puppeteer wait for the page to load completely?


    I struggle to take clear screenshots. The issue happens with websites that don't initially include direct links to resources such as images in their HTML code. As a result, the page load event triggers early, typically after the initial DOM has been parsed, which is too soon for these particular sites. So, how can I make puppeteer wait for the page of this type to fully load?
      My Computer


  2. Posts : 10
    Windows 10
       #2

    Off the top of my head, puppeteer networkidle0 could work. So the screenshot won't be taken until there is a minimum of 500ms between any network requests. Without knowing more, the best I can do is offer you a few options (see here). I believe one of them will work for the type of websites you have problems with. There are ways around it.
      My Computer


  3. Posts : 43
    Windows 11
    Thread Starter
       #3

    matthewgeek said:
    Off the top of my head, puppeteer networkidle0 could work. So the screenshot won't be taken until there is a minimum of 500ms between any network requests. Without knowing more, the best I can do is offer you a few options (see here). I believe one of them will work for the type of websites you have problems with. There are ways around it.
    Thank you. You were right, it worked. I started loosing it
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:30.
Find Us




Windows 10 Forums