'When it is better to use page.type() or page$eval() to input text with Puppeteer?
I am using Puppeteer to insert some text (an email address) into an input field on a web page. By reading online docs and blogs, I found two ways to do it. To input the value "directly" by using:
page.$eval('input[type="email"]', element => element.setAttribute("value", "[email protected]"))
or to input the text as a user would do, by using:
page.keyboard.type("[email protected]")
What are the pros/cons of the two commands? When shall I prefer one over the other?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
