Categories
JavaScript Answers

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

Spread the love

Sometimes, we want to wait N seconds before continuing to the next line with Puppeteer.

In this article, we’ll look at how to wait N seconds before continuing to the next line with Puppeteer.

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

To wait N seconds before continuing to the next line with Puppeteer, we can use the waitForTimeout method.

For instance, we write

await page.waitForTimeout(1000);
await frame.waitForTimeout(1000);

to call waitForTimeout to pause script execution on the page or frame for 1 second.

Conclusion

To wait N seconds before continuing to the next line with Puppeteer, 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 *