I'm trying to open each link on the given web page in a new tab But by clicking two links, it throws this error. Any suggestions would help. Thanks.
Here is my code:
public class FirstClass {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("https://www.google.com/");
Actions action = new Actions(driver);
List<WebElement> web = driver.findElements(By.tagName("a"));
for (int i = 1; i < web.size(); i++) {
System.out.println(web.get(i).getText());
action.moveToElement(web.get(i)).keyDown(Keys.CONTROL).click().build().perform();
}
}
}
Here is an error which I got -
Exception in thread "main" org.openqa.selenium.JavascriptException: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite.