Puppeteer wait for all images to load then take screenshot

前端 未结 5 1127
抹茶落季
抹茶落季 2020-12-23 16:38

I am using Puppeteer to try to take a screenshot of a website after all images have loaded but can\'t get it to work.

Here is the code I\'ve got so far, I am using h

5条回答
  •  清酒与你
    2020-12-23 17:10

    I'm facing the exact same issue. I have a feeling the solution will involve using:

    await page.setRequestInterceptionEnabled(true);
    
    page.on('request', interceptedRequest => {
        //some code here that adds this request to ...
        //a list and checks whether all list items have ...
        //been successfully completed!
    });
    

    https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetrequestinterceptionenabledvalue

提交回复
热议问题