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

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

Go to download

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

There is a newer version: 4.3.0
Show newest version
package aquality.selenium.core.elements;

import aquality.selenium.core.elements.interfaces.IElementStateProvider;
import org.openqa.selenium.WebElement;

public abstract class ElementStateProvider implements IElementStateProvider {

    protected boolean isElementEnabled(WebElement element) {
        return element.isEnabled();
    }

    protected DesiredState elementEnabled() {
        return new DesiredState(this::isElementEnabled, "ENABLED")
                .withCatchingTimeoutException()
                .withThrowingNoSuchElementException();
    }

    protected DesiredState elementNotEnabled() {
        return new DesiredState(element -> !isElementEnabled(element), "NOT ENABLED")
                .withCatchingTimeoutException()
                .withThrowingNoSuchElementException();
    }

    protected DesiredState elementClickable() {
        return new DesiredState(webElement -> webElement.isDisplayed() && webElement.isEnabled(), "CLICKABLE");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy