Sometimes, we want to wait N seconds before continuing to the next line with Puppeteer and JavaScript.
In this article, we’ll look at how to wait N seconds before continuing to the next line with Puppeteer and JavaScript.
How to wait N seconds before continuing to the next line with Puppeteer and JavaScript?
To wait N seconds before continuing to the next line with Puppeteer and JavaScript, we can use the waitForTimeout method.
For instance, we write
await page.waitForTimeout(1000)
to call page.waitForTimeout to wait for 1000 milliseconds before continuing to the next line in an async function.
Conclusion
To wait N seconds before continuing to the next line with Puppeteer and JavaScript, we can use the waitForTimeout method.