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.
*
* @author lenovo
* @version $Id: $Id
*/
public class DesiredState {
private final Predicate desiredStatePredicate;
private final String stateName;
private boolean isCatchingTimeoutException;
private boolean isThrowingNoSuchElementException;
/**
* Constructor for DesiredState.
*
* @param desiredStatePredicate a {@link java.util.function.Predicate} object.
* @param stateName a {@link java.lang.String} object.
*/
public DesiredState(Predicate desiredStatePredicate, String stateName){
this.desiredStatePredicate = desiredStatePredicate;
this.stateName = stateName;
}
/**
* getElementStateCondition.
*
* @return a {@link java.util.function.Predicate} object.
*/
public Predicate getElementStateCondition() {
return desiredStatePredicate;
}
/**
* Getter for the field stateName
.
*
* @return a {@link java.lang.String} object.
*/
public String getStateName() {
return stateName;
}
/**
* withCatchingTimeoutException.
*
* @return a {@link aquality.selenium.core.elements.DesiredState} object.
*/
public DesiredState withCatchingTimeoutException(){
this.isCatchingTimeoutException = true;
return this;
}
/**
* withThrowingNoSuchElementException.
*
* @return a {@link aquality.selenium.core.elements.DesiredState} object.
*/
public DesiredState withThrowingNoSuchElementException(){
this.isThrowingNoSuchElementException = true;
return this;
}
/**
* isCatchingInTimeoutException.
*
* @return a boolean.
*/
public boolean isCatchingInTimeoutException() {
return isCatchingTimeoutException;
}
/**
* isThrowingNoSuchElementException.
*
* @return a boolean.
*/
public boolean isThrowingNoSuchElementException() {
return isThrowingNoSuchElementException;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy