Categories
JavaScript Answers

How to press Enter button in Puppeteer and JavaScript?

Spread the love

Sometimes, we want to press Enter button in Puppeteer and JavaScript.

In this article, we’ll look at how to press Enter button in Puppeteer and JavaScript.

How to press Enter button in Puppeteer and JavaScript?

To press Enter button in Puppeteer and JavaScript, we use the page.keyboard.press method.

For instance, we write

await page.keyboard.press("Enter");
await page.keyboard.press("NumpadEnter");

to call press with 'Enter' to press the enter key.

And we call press with 'NumpadEnter' to press the numpad enter key.

Conclusion

To press Enter button in Puppeteer and JavaScript, we use the page.keyboard.press 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 *