What is a Stale Element Reference Exception?

A Stale Element Reference Exception occurs in Selenium when you have try to reference an element that Selenium determines is no longer a valid target for interaction. This can occur due to having captured an element in an object, and then trying to use that object after the page has been refreshed, or the page's DOM has somehow been altered, typically due to some JavaScript or other dynamic app code executing. Since Selenium tries to enforce that it can only perform actions that an actual human user could perform on the page, once it detects an event that would potentially affect the validity of the element as a human-interactable element, it marks the element as being "stale," and prevents any further manipulation of that element.

Tips for correcting/preventing Stale Element Reference Exceptions

-- StanVogel - 22 Apr 2020
Topic revision: r1 - 22 Apr 2020, StanVogel
© 2020 Ultranauts - 75 Broad Street, 2nd Floor, Suite 206, New York, NY 10004 - info@ultranauts.co