I keep getting an error message in my selenium java project.
for(WebElement link:AllTheLinkList) {
if (link.getAttribute("href") != null
&& ! link.getAttribute("href").contentEquals("javascript"))
{
activeLinks.add(link);
}
}
// Get total amount of links in the page
System.out.println("Size of active links and images --->"
+ activeLinks.size());
Error message is:
Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document