How to make protractor press the enter key?

bodine picture bodine · Nov 11, 2013 · Viewed 72.8k times · Source

I've tried this:

browser.actions().keyDown(protractor.Key.ENTER).keyUp(protractor.Key.Enter).perform();

which gives the error:

Error: Not a modifier key

Answer

Jmr picture Jmr · Nov 12, 2013

Keyup/Keydown is limited to modifier keys in WebDriver (shift, ctrl, etc). I think you want

browser.actions().sendKeys(protractor.Key.ENTER).perform();