All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aquality.selenium.core.elements.DesiredState Maven / Gradle / Ivy

Go to download

Library with core functions simplifying work with Selenium-controlled applications.

There is a newer version: 4.2.0
Show newest version
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