I used the below code options to open a hyperlink in the same window and a different tab, but every time the link will open in a different window.
1)
String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,Keys.RETURN);
driver.findElement(By.linkText(linkText)).sendKeys(selectLinkOpeninNewTab);
2)
Actions act = new Actions(driver);
act.moveToElement(element).doubleClick(element))).build().perform();
3)
Actions act = new Actions(driver);
act.contextClick(driver.findElement(By.xpath(element)))
.sendKeys(Keys.ARROW_DOWN)
.sendKeys(Keys.ARROW_DOWN)
.sendKeys(Keys.RETURN)
.build()
.perform();
Expecting link should be open in the same window different tab, but every time it is opening in the new window.
Please help.