Stale element reference exception
Selenium is holding a reference to a DOM node that the application replaced or detached after it was located.
RECOGNIZABLE ERROR
StaleElementReferenceException: stale element referenceRANKED DIAGNOSIS
What usually causes it
- 01
The framework re-rendered the component
React, Vue, or another UI layer replaced the node after state changed.
DIAGNOSE
Check whether the failure follows navigation, filtering, or a network response.
FIX
Locate the element immediately before the interaction instead of caching WebElement references.
- 02
The document or frame changed
Navigation or frame replacement invalidated every reference from the previous document.
DIAGNOSE
Confirm the active URL and frame before the failed action.
FIX
Wait for navigation or frame attachment, switch context, and locate again.
- 03
A polling loop reuses the same element
Retry code may repeatedly act on a reference that cannot become valid again.
DIAGNOSE
Inspect whether the retry callback captures a WebElement outside the loop.
FIX
Put the locator lookup inside the wait or retry callback.
Prevent the repeat
- →Store locators, not element instances.
- →Wait on state changes, not sleep durations.
- →Keep frame transitions explicit.
Primary references
Run this against your evidence
The browser triage workflow uses the same stable pattern slug and does not upload your paste.