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

net.thucydides.core.webdriver.AbstractObjectInitialiser Maven / Gradle / Ivy

There is a newer version: 4.2.8
Show newest version
package net.thucydides.core.webdriver;

import com.google.common.base.Predicate;
import org.openqa.selenium.WebDriver;

import java.time.Duration;

public abstract class AbstractObjectInitialiser implements Predicate {

    protected final WebDriver driver;
    protected final Duration ajaxTimeout;

    public AbstractObjectInitialiser(WebDriver driver, long ajaxTimeoutInMilliseconds) {
        this.driver = driver;
        this.ajaxTimeout = Duration.ofMillis(ajaxTimeoutInMilliseconds);
    }

    protected int ajaxTimeoutInSecondsWithAtLeast1Second() {
        return (int) ((ajaxTimeout.getSeconds() > 0) ? ajaxTimeout.getSeconds() : 1);
    }

    @Override
    public abstract boolean apply(T input);

    public boolean test(T input) {
        return apply(input);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy