开发者

How to solve selenium exception: StaleElementReferenceException: Element not found in the cache

开发者 https://www.devze.com 2023-04-13 05:17 出处:网络
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.Sta

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.

What a开发者_StackOverflowm I doing wrong?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消