For automation purposes, I am working on creating a script that finds a row in a table. This row is clickable and opens a new tab/adress.
With selenium, I am now ab
**Try this code:**
public static void switchToNewWindow(WebDriver driver, WebElement
causeOfNewWindow) {
// Get Handles before opening new window
Set oldHandles = driver.getWindowHandles();
// Click element to open new Window
causeOfNewWindow.click();
// Get Handles after opening new window
Set newHandles = driver.getWindowHandles();
for (String handle : newHandles) {
if (!oldHandles.contains(handle)) {
driver.switchTo().window(handle);
}
}
}