0

TestCase: Right click on link element and open in NEW TAB or NEW WINDOW.

I could able to right click on the element using the below code. But not sure how to select the option of "OPEN Link in NEW TAB".

TRIED:

browser.actions().mouseMove(rightClickEle).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
2
  • Here's several options you might consider... stackoverflow.com/questions/28536948/… Commented Jul 12, 2018 at 16:35
  • @CaptainKidd , No You dont find solution to "RIGHT CLICK and Open in NEW TAB " in the source you are referring to
    – Bustaq
    Commented Jul 26, 2018 at 7:34

1 Answer 1

0

Finally I sorted out the solution to "RIGHT CLICK AND OPEN IN NEWTAB".

var rightClickEle = browser.driver.findElement(by.xpath("//a[contains(text(),'linkA')]"));
browser.actions().mouseMove(rightClickEle).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
browser.actions().mouseMove(rightClickEle).keyDown(protractor.Key.CONTROL).click().perform();
browser.actions().mouseMove(rightClickEle).keyDown(protractor.Key.CONTROL).click().keyUp(protractor.Key.CONTROL).perform();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.