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

ru.yandex.qatools.actions.beans.AbstractWaitForElementAction Maven / Gradle / Ivy

The newest version!
package ru.yandex.qatools.actions.beans;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public abstract class AbstractWaitForElementAction extends WebElementAction {
    public abstract int getMaxWaitTime();

    public static final int CHECK_INTERVAL = 100;

    @Override
    public void perform(WebDriver webDriver) {
        WebDriverWait wait = new WebDriverWait(webDriver, getMaxWaitTime(), CHECK_INTERVAL);
        wait.until(ExpectedConditions.presenceOfElementLocated(buildBy()));
    }

    @Override
    public String toString() {
        return String.format("wait for '%s' maxWaitTime '%d'", buildBy(), getMaxWaitTime());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy