I want to click a href link, then go back to previous page, then click next href link which has text "Meer info".
I wrote following code, but it is producing an Exception. I can go to web then click first link that I want to click with text name "Meer info" than go to back but then I want to click second linkText also with the same text name "Meer info" but I don't know how to do that.
WebDriver driver = new FirefoxDriver();
driver.get("http://turksegids.nl/index.php");
Thread.sleep(3000);
driver.findElement(By.cssSelector("input[type='image'][value='Zoek!']")).click();
Thread.sleep(5000);
driver.findElement(By.linkText("Meer info")).click();
Thread.sleep(4000);
driver.findElement(By.linkText("Terug naar de resultatenpagina")).click();
Thread.sleep(8000);
driver.findElement(By.linkText("//a[text()=\"Meer info\"]/following-
sibling::a[2]")).click();
Thread.sleep(4000);
driver.close();
driver.quit();
I am getting this Exception
Unable to locate element: {"method":"link text","selector":"//a[text()=\"Meer info\"]/following-sibling::a[2]"}