Quality Testing

Quality is delighting customers

How to handle it?

Views: 488

Reply to This

Replies to This Discussion

Hi Madhavi,


StaleElementReferenceException is one of the different WebDriver Exceptions and this Exception occurs mainly because of page navigations in between the execution of Selenium code. i.e. This exception occurs, when Selenium navigates to a different page, come backs to the same old page and performs operations on the old page. 

Please find the step by step explanation for handling Stale Element Exception at the below URL :

http://selenium-by-arun.blogspot.com/2017/05/staleelementreferencee...

Regards,

Arun.

Here you get a complete information - StaleElementReferenceException

Thank you guys!

Hi,

Stale means old, decayed, no longer fresh. Stale Element means an old element or no longer available element. Assume there is an element that is found on a web page referenced as a WebElement in WebDriver. If the DOM changes then the WebElement goes stale

Click here to more information.

In web application testing services the main reason of StaleElementReferenceException is due to the unavailability of an element being accessed by findelement method.

When an element which is found on a web page and referenced as a WebElement in WebDriver then the DOM changes that WebElement goes stale. It results the StaleElementReferenceException.
We can fix the StaleElementReferenceException by using below options:

  • Waiting for an element's visibility
  • Use the Selenium Expected Conditions to wait for the WebElement.
  • Storing locators to your elements instead of references
  • Leverage hooks in the JS libraries used
  • Moving your actions into JavaScript injection
  • Proactively wait for the element to go stale

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service