diff --git a/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementFacadeImpl.java b/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementFacadeImpl.java index c161a6bdd..bd012dd93 100644 --- a/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementFacadeImpl.java +++ b/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementFacadeImpl.java @@ -18,6 +18,7 @@ import net.thucydides.core.webdriver.stubs.WebElementFacadeStub; import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.*; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.Coordinates; @@ -1045,7 +1046,10 @@ private boolean hasValueAttribute(WebElement element) { @Override public Wait waitForCondition() { - return new FluentWait<>(driver, webdriverClock, sleeper).withTimeout(Duration.ofMillis(waitForTimeoutInMilliseconds)).pollingEvery(Duration.ofMillis(WAIT_FOR_ELEMENT_PAUSE_LENGTH)).ignoring(NoSuchElementException.class, NoSuchFrameException.class); + return new FluentWait<>(driver, webdriverClock, sleeper) + .withTimeout(Duration.ofMillis(waitForTimeoutInMilliseconds)) + .pollingEvery(Duration.ofMillis(WAIT_FOR_ELEMENT_PAUSE_LENGTH)) + .ignoring(NoSuchElementException.class, NoSuchFrameException.class, StaleElementReferenceException.class); } @Override