0

Selenium: is there a way to tell if an element is stale from debugger such as Eclipse?

org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
0

1 Answer 1

0

Stale element errors is what happens when your test has fetched an element from an outdated version of the DOM. More specifically when the element that the test has is no longer attached to the DOM.

The trick to avoiding stale element errors is to make sure the test doesn't fetch elements from the DOM until the page has finished loading. Also make sure that if interacting with an element causes the state to change significantly, that the test does not attempt to retrieve those elements until the state of the application has fully transitioned.

Here's a good overview of stale elements from Mozilla: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Errors/StaleElementReference

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.