Skip to content

Commit

Permalink
Merge pull request #234 from zebrunner/default-wait-logic
Browse files Browse the repository at this point in the history
fix(ExtendedWebElement): too strict wait by presence
  • Loading branch information
akamarouski authored Nov 15, 2024
2 parents cf1a51a + 2570bfc commit b081a5a
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1722,23 +1722,7 @@ protected ExpectedCondition<?> getDefaultElementWaitCondition() {
List<ExpectedCondition<?>> conditions = new ArrayList<>();
if (loadingStrategy == ElementLoadingStrategy.BY_PRESENCE || loadingStrategy == ElementLoadingStrategy.BY_PRESENCE_OR_VISIBILITY) {
if (element != null) {
conditions.add(
new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver ignored) {
try {
// Calling any method forces a staleness check
return element.isDisplayed();
} catch (StaleElementReferenceException expected) {
return false;
}
}

@Override
public String toString() {
return String.format("element (%s) to become stale", element);
}
});
conditions.add(ExpectedConditions.not(ExpectedConditions.stalenessOf(element)));
}
if (by != null) {
conditions.add(getSearchContext() instanceof WebElement
Expand Down

0 comments on commit b081a5a

Please sign in to comment.