I'm getting collection of links. Then I click first link, do something, moving back (driver.navigate().back();
), getting second link and then link.click();
throws an exception org.openqa.selenium.StaleElementReferenceException: Element not found in the cache
.
As soon as you navigate away from the page the element variables become invalid. The trick is to find the first element, click, go back and then find the second element and click.
精彩评论