如何在 Puppeteer 中模拟键盘输入
要模拟用户在键盘上输入内容,使用
puppeteer_emulate_keyboard_input.js
await page.keyboard.type("the text");这将极快地输入文本,字符之间几乎没有延迟。
为了模拟真实用户有限的打字速度,使用
puppeteer_keyboard_type_delay.js
await page.keyboard.type("the text", {delay: 100});代替。此示例中字符之间的延迟为 100 毫秒,即模拟用户每秒输入 10 个字符。
Check out similar posts by category:
Javascript, NodeJS, Puppeteer
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow