Skip to main content

Handling StaleElementReferenceException

A StaleElementReferenceException occurs when an element that was previously located on the web page is no longer attached to the DOM (Document Object Model). This typically happens when:

  • The page is refreshed.
  • A dynamic element is removed or replaced.
  • The page state changes significantly after the initial element location.

Kolibrium's automatic handling of StaleElementReferenceException

Kolibrium provides an innovative approach to handling stale elements:

  • Automatically relocates the element(s) when a StaleElementReferenceException occurs.
  • Logs a warning message to help developers track stale elements.
12:01:07.295 [ForkJoinPool-1-worker-1] WARN  d.k.selenium.LocatorDelegates - "button" element(s) with locator strategy of { By.id: myButton } became stale. Relocating.