Categories
JavaScript Answers

How to fill an input field using Puppeteer and JavaScript?

Spread the love

Sometimes, we want to fill an input field using Puppeteer and JavaScript.

In this article, we’ll look at how to fill an input field using Puppeteer and JavaScript.

How to fill an input field using Puppeteer and JavaScript?

To fill an input field using Puppeteer and JavaScript, we can use the page.keyword.type method.

For instance, we write

await page.focus("#email");
await page.keyboard.type("test");

to focus on the input with ID email with

await page.focus("#email");

Then we type in the input we focused on with

await page.keyboard.type("test");

Conclusion

To fill an input field using Puppeteer and JavaScript, we can use the page.keyword.type method.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.