0

When driver.findElement(By.id(eachtitle)).click(); is excecuted application is throwing

stale element reference: element is not attached to the page document error.

List<WebElement> visits = driver.findElements(By.xpath("//div[@class= \"scrollingbutton\"]"));

System.out.println(visits.size());

for(WebElement eachvisit : visits) {            
       String eachtitle = eachvisit.getAttribute("id");
       driver.findElement(By.id(eachtitle)).click();
}
cske
  • 2,233
  • 4
  • 26
  • 24
  • Possible duplicate of [How to avoid "StaleElementReferenceException" in Selenium?](https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium) – Vladimir Efimov Nov 02 '18 at 11:59
  • possible duplicate of https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium – Vladimir Efimov Nov 02 '18 at 11:59
  • Welcome to stackoverflow. Before asking a question on this forum try to find the solution on your own. The question you have asked is already been answer as point by @VladimirEfimov. Also go through the link for guide line. [how to ask question](https://stackoverflow.com/help/how-to-ask) and [Help Center >> Asking](https://stackoverflow.com/help/asking). – Alok Nov 03 '18 at 08:20

0 Answers0