I am working on a code which includes clicking on a link and that should open in a new tab using webdriver, the problem is.The supposed link is contained in iFrame, soshift+click isn't working
private void openInNewTabAndSwitch(WebElement linkElement) {
// logic of opening in new tab goes here...
Actions newTab = new Actions(driver);
newTab.keyDown(Keys.SHIFT).click(linkElement).keyUp(Keys.SHIFT).build().perform();
Set<String> windowSet = driver.getWindowHandles();
driver.switchTo().window((String) windowSet.toArray()[1]); }
I cannot find the href attribute since some javascript function is opening it using some onClick()
<a onclick="javascript:LinkOccam (this, 'opportunity');">Mednomics Proposition</a>
It simply opens the required page in same tab.