Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pressing Enter button in puppeteer

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 image description here

Any ideas?

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

like image 308
elena Avatar asked Sep 27 '17 07:09

elena


People also ask

How do you press Enter key in playwright?

type(text[, options])​ Sends a keydown , keypress / input , and keyup event for each character in the text. To press a special key, like Control or ArrowDown , use keyboard. press(key[, options]).


1 Answers

I've used page.keyboard.press('Enter'); usually :) Works for me.

Have a look at the documentation here. I think you should use .keyboard before .press for it to work properly.

like image 190
kaiak Avatar answered Sep 20 '22 17:09

kaiak