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.