How do you avoid Stale Element Exception | Selenium Webdriver Tutorial with c# |Selenium C# training
15% Colorful Festival Offer Avail now

Selenium C# Training Forum

How do you avoid Stale Element Exception

M
MAHESH LAXMANRAO KHOLE Post on 01/03/2019

  1. How do you avoid Stale Element Exception?
  2. How to Check if the image loaded is broken or not

G

Instructor

gunjan Reply on 02/03/2019

To control the staleness of an element, try adding the explicit wait for the element or else try this:

bool staleElement = true;
while (staleElement)
{
try
{
driver.FindElement(By.XPath("")).Click();
staleElement = false;
}
catch (StaleElementReferenceException)
{
staleElement = true;
}
}

G

Instructor

gunjan Reply on 02/03/2019

To check if the image loaded is broken or not, try this link-

https://stackoverflow.com/questions/43389340/how-to-find-broken-images-for-an-entire-web-site-in-selenium-webdriver-using-jav

M
MAHESH LAXMANRAO KHOLE Reply on 03/03/2019

Thanks Gunjan