I have a div
with a unique ID. Under that div
are a bunch of span
elements that have className=foo
. There are several span
elements with className=foo
but they are unique to each div
(if that's clear). So my Selenium code first gets the unique div
as a web element then tries to take that element and get by class name the span
like so
element = sDriver.findElement(By.id("c_"+cID));
String sTest = element.findElement(By.className("actions")).getText();
On the second line it throws an exception every time
org.openqa.selenium.StaleElementReferenceException: Element not found in the cache - perhaps the page has changed since it was looked up
Command duration or timeout: 22 milliseconds
Do I misunderstand how to get that span
from under a unique div
?