Categories
JavaScript Answers

How to wait N seconds before continuing to the next line with Puppeteer and JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *