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

com.codeborne.selenide.Conditional Maven / Gradle / Ivy

The newest version!
package com.codeborne.selenide;

import com.codeborne.selenide.impl.Waiter;
import com.google.errorprone.annotations.CanIgnoreReturnValue;

import java.time.Duration;

/**
 * 

* Implements wait for non WebElement based conditions. * Accepts predicate as condition. *

* *

* To use it just implement for appropriate type, * e.g. {@code YourType implements Conditional} *

* * {@link com.codeborne.selenide.impl.Waiter} */ public interface Conditional { /** * @return current Driver (used to take screenshots etc. in case of test failure) */ Driver driver(); /** * @return object under test */ T object(); @CanIgnoreReturnValue default Conditional shouldHave(ObjectCondition predicate) { new Waiter().wait(driver(), object(), predicate); return this; } @CanIgnoreReturnValue default Conditional shouldHave(ObjectCondition predicate, Duration timeout) { new Waiter().wait(driver(), object(), predicate, timeout); return this; } @CanIgnoreReturnValue default Conditional shouldNotHave(ObjectCondition predicate) { new Waiter().waitWhile(driver(), object(), predicate); return this; } @CanIgnoreReturnValue default Conditional shouldNotHave(ObjectCondition predicate, Duration timeout) { new Waiter().waitWhile(driver(), object(), predicate, timeout); return this; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy