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();
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With