I've tried this:
browser.actions().keyDown(protractor.Key.ENTER).keyUp(protractor.Key.Enter).perform();
which gives the error:
Error: Not a modifier key
I've tried this:
browser.actions().keyDown(protractor.Key.ENTER).keyUp(protractor.Key.Enter).perform();
which gives the error:
Error: Not a modifier key
Keyup/Keydown is limited to modifier keys in WebDriver (shift, ctrl, etc). I think you want
browser.actions().sendKeys(protractor.Key.ENTER).perform();
The actions() is not required.
You can do something like:
var input = $('#someInput');
input.sendKeys(protractor.Key.ENTER);
Update: some people have complained that you are not sending the enter to browser. If you want to do this just change your selector:
$('body').sendKeys(protractor.Key.ENTER);
Here is another way of doing this
var enter = browser.actions().sendKeys(protractor.Key.ENTER);
enter.perform();
From the docs here...
http://appfigures.github.io/webdriver-js-api-reference/symbols/webdriver.WebElement.html#sendKeys
var myInput = element(by.model('myModel.inputName'));
myInput.sendKeys(value, protractor.Key.ENTER);
Also other examples from the docs linked above.
myInput.sendKeys("text was",
protractor.Key.CONTROL, "a", protractor.Key.NULL,
"now text is");
// Alternatively:
myInput.sendKeys("text was",
protractor.Key.chord(protractor.Key.CONTROL, "a"),
"now text is");