Reputation: 2371
Similar to the question here. My tests are unstable. Try and catch solution will not work here. Any best practices to solve this?
Upvotes: 0
Views: 250
Reputation: 4173
Maybe there is a coding issue, you search for an element before and you are using that object later.
You should not get stale element if the page was not changed/reloaded.
Upvotes: 0
Reputation: 1761
As @lauda says above, the StaleElementReferenceException is a clear indication that the page you are interacting with has changed since you last obtained the object reference. You must carefully review what is happening between those two points in the code to determine what has caused the page to reload. That will help you decide how to handle the situation in the context of your automation framework.
A few suggestions:
Upvotes: 2