aquality.selenium.core.elements.DesiredState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aquality-selenium-core Show documentation
Show all versions of aquality-selenium-core Show documentation
Library with core functions simplifying work with Selenium-controlled applications.
package aquality.selenium.core.elements;
import org.openqa.selenium.WebElement;
import java.util.function.Predicate;
/**
* Defines desired state for element with ability to handle exceptions.
*/
public class DesiredState {
private final Predicate desiredStatePredicate;
private final String stateName;
private boolean isCatchingTimeoutException;
private boolean isThrowingNoSuchElementException;
public DesiredState(Predicate desiredStatePredicate, String stateName){
this.desiredStatePredicate = desiredStatePredicate;
this.stateName = stateName;
}
public Predicate getElementStateCondition() {
return desiredStatePredicate;
}
public String getStateName() {
return stateName;
}
public DesiredState withCatchingTimeoutException(){
this.isCatchingTimeoutException = true;
return this;
}
public DesiredState withThrowingNoSuchElementException(){
this.isThrowingNoSuchElementException = true;
return this;
}
public boolean isCatchingInTimeoutException() {
return isCatchingTimeoutException;
}
public boolean isThrowingNoSuchElementException() {
return isThrowingNoSuchElementException;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy