How can I do Ctrl + Click on the protractor?

I tried a strange combination as follows, but none of them work:

var ptor = protractor.getInstance();
ptor.actions().mouseMove(node).keyDown(ptor.Key.CTRL).sendKeys(ptor.Key.CLICK).perform();
+4
source share
1 answer

You need to bind 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 in Chrome by clicking on the link - opens the link in a new tab.


Note that starting with protractor 1.5, there is a global object browserthat should be used instead protractor.getInstance(), see Breaking Changes .

+8
source

Source: https://habr.com/ru/post/1570329/


All Articles