Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  66] [ 1]  / answers: 1 / hits: 94600  / 7 Years ago, wed, september 27, 2017, 12:00:00

Pressing enter in puppeteer doesn't seem to have any effect. However, when I press other keys, it does what it should.
This works:



await page.press('ArrowLeft');


This doesn't:



await page.press('Enter');


This is how the input looks like:



enter



Any ideas?



EDIT: I've also tried page.keyboard.down & page.keyboard.up to be sure.


More From » node.js

 Answers
40
await page.type(String.fromCharCode(13));


Using this site I noticed that page.type dispatches beforeinput and input events, but page.press doesn't. This is probably a bug, but fortunately sending the enter keycode (13) seems to work, so we can work around it for now.


[#56374] Sunday, September 24, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zainsagez

Total Points: 555
Total Questions: 99
Total Answers: 96

Location: Honduras
Member since Sat, Jul 24, 2021
3 Years ago
zainsagez questions
;