In my understanding such exception can be thrown only if the code operates on a WebElement
instance, calling methods on it after the corresponding DOM element has been reloaded or removed.
So in order to find out if RemoteWebDriver.findElements(By)
can throw that exception or not I looked for that kind of code in the source of the RemoteWebDriver
implementation of WebDriver
interface (in selenium-remote-driver-3.8.1.jar
). But following the call stacks deep down into RemoteWebDriver
's code eventually became too difficult for me.
So my question is: besides trying to figure that out by inspecting Selenium source, are there better ways to tell if a WebDriver
method in general - or just findElements(By)
in particular - can throw StaleElementReferenceException
? It's a RuntimeException
, and the Selenium JavaDoc doesn't have @throws
for it.