Reputation: 27
I'm experimenting with JavaScript and puppeteer and when I go onto a site I have set it up so it takes a screenshot, but the problem is some elements of the website haven't loaded in when it takes the screenshot, is there anything I can do to add a delay?
Upvotes: 0
Views: 135
Reputation: 1203
Check my answer at: https://stackoverflow.com/a/57677369/10251383
Try this options with your page.goto():
await page.goto(url, { waitUntil: 'load' });
await page.goto(url, { waitUntil: 'domcontentloaded' });
await page.goto(url, { waitUntil: 'networkidle0' });
await page.goto(url, { waitUntil: 'networkidle2' });
Upvotes: 1