net.serenitybdd.screenplay.waits.WaitUntil Maven / Gradle / Ivy
package net.serenitybdd.screenplay.waits;
import net.serenitybdd.core.pages.WebElementState;
import net.serenitybdd.screenplay.Interaction;
import net.serenitybdd.screenplay.targets.Target;
import org.hamcrest.Matcher;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedCondition;
import static net.serenitybdd.screenplay.Tasks.instrumented;
public class WaitUntil {
public static WaitUntilTargetIsReady the(Target target, Matcher expectedState) {
return instrumented(WaitUntilTargetIsReady.class, target, expectedState);
}
public static WaitUntilTargetIsReady the(String xpathOrCSSSelector, Matcher expectedState) {
return instrumented(WaitUntilTargetIsReady.class, Target.the(xpathOrCSSSelector).locatedBy(xpathOrCSSSelector), expectedState);
}
public static WaitUntilTargetIsReady the(By byLocator, Matcher expectedState) {
return instrumented(WaitUntilTargetIsReady.class, Target.the(byLocator.toString()).located(byLocator), expectedState);
}
public static WaitUntilExpectation the(ExpectedCondition expectedCondition) {
return new WaitUntilExpectation<>(expectedCondition);
}
public static Interaction angularRequestsHaveFinished() {
return instrumented(WaitUntilAngularIsReady.class);
}
}