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

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

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

import org.openqa.selenium.WebDriver;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

/**
 * Created by john on 30/01/15.
 */
public class TimeoutsFacade implements WebDriver.Timeouts {

    private final WebDriverFacade webDriverFacade;
    private final WebDriver.Timeouts timeouts;

    public TimeoutsFacade(WebDriverFacade webDriverFacade, WebDriver.Timeouts timeouts) {
        this.webDriverFacade = webDriverFacade;
        this.timeouts = timeouts;
    }

    @Override
    public WebDriver.Timeouts implicitlyWait(long timeoutValue, TimeUnit timeUnit) {
        webDriverFacade.implicitTimeout = Duration.of(timeoutValue, TemporalUnitConverter.fromTimeUnit(timeUnit));
        return (timeouts != null) ? timeouts.implicitlyWait(timeoutValue,timeUnit) : timeouts;
    }

    @Override
    public WebDriver.Timeouts setScriptTimeout(long timeoutValue, TimeUnit timeUnit) {
        return (timeouts != null) ? timeouts.setScriptTimeout(timeoutValue, timeUnit) : timeouts;
    }

    @Override
    public WebDriver.Timeouts pageLoadTimeout(long timeoutValue, TimeUnit timeUnit) {
        return (timeouts != null) ? timeouts.pageLoadTimeout(timeoutValue,timeUnit) : timeouts;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy