How may I click on a link using context menu so that the page is opened in a new tab?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

by (171 points)
0 votes

Performing context menu click is little tricky part here. You need to use Action classes here.


Open in new window.

WebElement link = getMyDriver().findElement(By.id("yourElementIdHere"));
Actions actions= new Actions(getMyDriver());
Open in new tab.
WebElement link = getMyDriver().findElement(By.id("MyIdHere"));
Actions actions= new Actions(getMyDriver());
Hope above code helps.