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

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 that you have read and understand our privacy policy and code of conduct.

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