hoang nguyen hoang nguyen - 1 year ago 69
Java Question

How to avoid "StaleElementReferenceException" in Selenium?

I'm implementing a lot of Selenium tests using Java. Sometimes, my tests fail due to a

. Could you suggest some approaches to making the tests more stable?

Answer Source

This can happen if a DOM operation happening on the page is temporarily causing the element to be inaccessible. To allow for those cases, you can try to access the element several times in a loop before finally throwing an exception.

see this excellent solution:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download