Skip to content

Commit

Permalink
Impoved Debug output for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstamann committed Dec 10, 2024
1 parent 3195dea commit 4474c0e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.time.Duration;
import java.util.Collection;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -36,6 +37,7 @@ public void executeAction(WebElement webElement) {
new FluentWait<>(driver)
.withTimeout(Duration.ofSeconds(15))
.pollingEvery(Duration.ofMillis(300))
.withMessage("Element based action '" + this.getClass().getCanonicalName() + "' with side condition '" + this.sideCondition.getClass().getCanonicalName() + "'")
.ignoreAll(getExceptionsToIgnore());

applyAction(wait.until(new OnElementCondition(webElement)));
Expand All @@ -52,12 +54,17 @@ public void executeAction(By locator) {
new FluentWait<>(driver)
.withTimeout(Duration.ofSeconds(15))
.pollingEvery(Duration.ofMillis(300))
.withMessage("Locator '" + locator.toString() + "' based action '" + this.getClass().getCanonicalName() + "' with side condition '" + this.sideCondition.getClass().getCanonicalName() + "'")
.ignoreAll(getExceptionsToIgnore());

applyAction(wait.until(new WithLocatorCondition(locator)));

}

protected String getLocatorMessage() {
return "Wasn't able to locate with locator of type '" + this.getClass().getCanonicalName() + "' and side condition '" + this.sideCondition.getClass().getCanonicalName() + "'";
}


class OnElementCondition implements ExpectedCondition<WebElement> {

Expand Down

0 comments on commit 4474c0e

Please sign in to comment.