Pressing Enter button in puppeteer

elena picture elena · Sep 27, 2017 · Viewed 42.7k times · Source

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.

Answer

kaiak picture kaiak · Nov 20, 2017

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.