Site icon

StaleElementReferenceException in Selenium

How Selenium locate a particular web element on the Web page ?

Handle StaleElementReferenceException:


@Test
public void StaleElementExceptionMethod() {
        try {
            // this method will throw StaleElement exception
             driver.findElement(locator).click();
        } catch (StaleElementReferenceException e) {
             driver.findElement(locator).click();
        }
     }

 

Exit mobile version