Reputation: 1876
I have tried weird combination as the following, but none of them are working:
var ptor = protractor.getInstance();
ptor.actions().mouseMove(node).keyDown(ptor.Key.CTRL).sendKeys(ptor.Key.CLICK).perform();
Upvotes: 6
Views: 5336
Reputation: 473853
You need to chain mouseMove()
, keyDown()
and click()
:
var elm = element(by.id('my_id'));
browser.actions()
.mouseMove(elm)
.keyDown(protractor.Key.CONTROL) // COMMAND for Mac
.click()
.perform();
Tested it on Chrome by clicking on a link - opens up a link in a new tab.
Note that, starting with protractor 1.5, there is a global browser
object that should be used instead of protractor.getInstance()
, see Breaking Changes.
Upvotes: 14