
at.willhaben.willtest.misc.pages.IsAvailableBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of misc Show documentation
Show all versions of misc Show documentation
Classes to use the Core and Browserstack module in JUnit tests
package at.willhaben.willtest.misc.pages;
import at.willhaben.willtest.misc.utils.ConditionType;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.Optional;
import java.util.function.Function;
public class IsAvailableBuilder extends AbstractWaitingBuilder> {
IsAvailableBuilder(PageObject pageObject, WebElement webElement) {
super(pageObject, webElement);
}
IsAvailableBuilder(PageObject pageObject, By by) {
super(pageObject, by);
}
@Override
public Optional clickable(long timeout) {
return waitFor(generateCondition(ConditionType.CLICKABLE), timeout);
}
@Override
public Optional visible(long timeout) {
return waitFor(generateCondition(ConditionType.VISIBLE), timeout);
}
private Optional waitFor(Function super WebDriver, T> findFunction, long timeout) {
try {
return Optional.of(getPageObject().getWait(timeout).until(findFunction));
} catch (TimeoutException e) {
return Optional.empty();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy