Reputation: 171
So i have this URL
that i want to surf into in new tab, the link is not clickable so when i click on this nothing happen and this will not work (even not manually):
WebElement hrefLink;
actions.keyDown(Keys.SHIFT).click(hrefLink).keyUp(Keys.SHIFT).build().perform();
// Handle windows change.
ArrayList<String> tabs = new ArrayList<String>(Browser.driver().getWindowHandles());
// Switch to the new tab.
driver.switchTo().window(tabs.get(1));
So i try this approach:
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + "t");
And no new tab openning.
Any suggestions ?
UPDATE
This is my web URL: https://bitly.com/
Upvotes: 1
Views: 422
Reputation: 186
You can start with this workaround:
void openNewTab(WebDriver driver) {
((JavascriptExecutor) driver).executeScript("window.open('https://google.com');");
}
And here is the question that resembles to yours. Maybe it will be useful ;)
Upvotes: 2