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

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

There is a newer version: 7.6.1
Show newest version
package com.codeborne.selenide;

import com.codeborne.selenide.impl.Waiter;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
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} * @since 5.23.0 */ @ParametersAreNonnullByDefault public interface Conditional { /** * @return current Driver (used to take screenshots etc. in case of test failure) */ @Nonnull @CheckReturnValue Driver driver(); /** * @return object under test */ @Nonnull @CheckReturnValue T object(); @Nonnull default Conditional shouldHave(ObjectCondition predicate) { new Waiter().wait(driver(), object(), predicate); return this; } @Nonnull default Conditional shouldHave(ObjectCondition predicate, Duration timeout) { new Waiter().wait(driver(), object(), predicate, timeout); return this; } @Nonnull default Conditional shouldNotHave(ObjectCondition predicate) { new Waiter().waitWhile(driver(), object(), predicate); return this; } @Nonnull default Conditional shouldNotHave(ObjectCondition predicate, Duration timeout) { new Waiter().waitWhile(driver(), object(), predicate, timeout); return this; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy