Skip to content

Commit

Permalink
Skip StaleElementReferenceException while use waitUntil*() methods (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
emaks authored Oct 13, 2023
1 parent b42c091 commit 0bce02a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1045,7 +1046,10 @@ private boolean hasValueAttribute(WebElement element) {

@Override
public Wait<WebDriver> 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
Expand Down

0 comments on commit 0bce02a

Please sign in to comment.