Class FluentWaitElement
- All Implemented Interfaces:
FluentWaitConditions<FluentWaitElement>
,FluentWaitConfiguration<FluentWaitElement>
,FluentWaitFunctional<FluentControl>
,org.openqa.selenium.support.ui.Wait<FluentControl>
FluentWait
object into a more
complete API, allowing to wait for any condition to be verified on an underlying element.
-
Constructor Summary
ConstructorDescriptionFluentWaitElement
(FluentWait controlWait, FluentWebElement element) Creates a new fluent wait for a given element. -
Method Summary
Modifier and TypeMethodDescriptionConfigure timeout for this wait object.explicitlyFor
(long amount, TimeUnit timeUnit) Waits unconditionally for an explicit amount of time.org.openqa.selenium.support.ui.FluentWait
getWait()
Get the underlying selenium wait objectboolean
Check if a message is defined.ignoreAll
(Collection<Class<? extends Throwable>> types) Add given exceptions to ignore list to avoid breaking the wait when they occurs in the underlying condition evaluation.ignoring
(Class<? extends RuntimeException> exceptionType) Add given exception to ignore list to avoid breaking the wait when they occurs in the underlying condition evaluation.ignoring
(Class<? extends RuntimeException> firstType, Class<? extends RuntimeException> secondType) Add given exceptions to ignore list to avoid breaking the wait when they occurs in the underlying condition evaluation.pollingEvery
(Duration duration) Configure polling time for this wait object.until()
Get a conditions object used to wait for condition on current element.<T> T
until
(Function<? super FluentControl, T> function) Deprecated.void
Wait until the supplier returns true.until
(List<? extends FluentWebElement> elements) Get a conditions object used to wait for a condition on given elements.until
(FluentWebElement element) Get a conditions object used to wait for condition on given element.untilAsserted
(Runnable block) waits until aRunnable
block execution ends without throwing an exception.untilEach
(List<? extends FluentWebElement> elements) Get a conditions object used to wait for a condition on given elements.untilEachElements
(Supplier<? extends List<? extends FluentWebElement>> selector) Get a conditions object used to wait for a condition on given elements.untilElement
(Supplier<? extends FluentWebElement> selector) Get a conditions object used to wait for a condition on given element.untilElements
(Supplier<? extends List<? extends FluentWebElement>> selector) Get a conditions object used to wait for a condition on given elements.Get a condition object used to wait for a page condition.untilPage
(FluentPage page) Get a condition object used to wait for a page condition.void
untilPredicate
(Predicate<FluentControl> predicate) Wait until the predicate returns true.untilWindow
(String windowName) Get a condition object used to wait for a window condition.withMessage
(Supplier<String> message) Configures a custom message supplier to be used if the condition fails during the timeout duration.Removes default exceptions from exceptions ignore list.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluentlenium.core.wait.FluentWaitConditions
explicitlyFor
Methods inherited from interface io.fluentlenium.core.wait.FluentWaitConfiguration
atMost, atMost, pollingEvery, pollingEvery, withMessage
-
Constructor Details
-
FluentWaitElement
Creates a new fluent wait for a given element.- Parameters:
controlWait
- underlying wait from control interfaceelement
- underlying element
-
-
Method Details
-
until
Get a conditions object used to wait for condition on current element.- Returns:
- conditions object
-
getWait
public org.openqa.selenium.support.ui.FluentWait getWait()Description copied from interface:FluentWaitConfiguration
Get the underlying selenium wait object- Specified by:
getWait
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Returns:
- selenium wait
-
atMost
Description copied from interface:FluentWaitConfiguration
Configure timeout for this wait object.- Specified by:
atMost
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Parameters:
duration
- duration- Returns:
this
object to chain method calls
-
pollingEvery
Description copied from interface:FluentWaitConfiguration
Configure polling time for this wait object.- Specified by:
pollingEvery
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Parameters:
duration
- duration between each condition invocation- Returns:
this
object to chain method calls
-
ignoreAll
Description copied from interface:FluentWaitConfiguration
Add given exceptions to ignore list to avoid breaking the wait when they occurs in the underlying condition evaluation.- Specified by:
ignoreAll
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Parameters:
types
- collection of exception type to ignore- Returns:
this
object to chain method calls
-
ignoring
Description copied from interface:FluentWaitConfiguration
Add given exception to ignore list to avoid breaking the wait when they occurs in the underlying condition evaluation.- Specified by:
ignoring
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Parameters:
exceptionType
- exception type to ignore- Returns:
this
object to chain method calls
-
ignoring
public FluentWaitElement ignoring(Class<? extends RuntimeException> firstType, Class<? extends RuntimeException> secondType) Description copied from interface:FluentWaitConfiguration
Add given exceptions to ignore list to avoid breaking the wait when they occurs in the underlying condition evaluation.- Specified by:
ignoring
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Parameters:
firstType
- exception type to ignoresecondType
- exception type to ignore- Returns:
this
object to chain method calls
-
withMessage
Description copied from interface:FluentWaitConfiguration
Configures a custom message supplier to be used if the condition fails during the timeout duration.- Specified by:
withMessage
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Parameters:
message
- failing message- Returns:
this
object to chain method calls
-
hasMessageDefined
public boolean hasMessageDefined()Description copied from interface:FluentWaitConfiguration
Check if a message is defined.- Specified by:
hasMessageDefined
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Returns:
- true if this fluent wait use a custom message, false otherwise
-
withNoDefaultsException
Description copied from interface:FluentWaitConfiguration
Removes default exceptions from exceptions ignore list.- Specified by:
withNoDefaultsException
in interfaceFluentWaitConfiguration<FluentWaitElement>
- Returns:
this
object to chain method calls
-
untilPredicate
Description copied from interface:FluentWaitFunctional
Wait until the predicate returns true.- Specified by:
untilPredicate
in interfaceFluentWaitFunctional<FluentControl>
- Parameters:
predicate
- predicate condition to wait for
-
until
Description copied from interface:FluentWaitFunctional
Wait until the supplier returns true.- Specified by:
until
in interfaceFluentWaitFunctional<FluentControl>
- Parameters:
isTrue
- supplier condition to wait for.
-
until
Description copied from interface:FluentWaitConditions
Get a conditions object used to wait for condition on given element.- Specified by:
until
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
element
- element to wait for- Returns:
- conditions object
-
until
Description copied from interface:FluentWaitConditions
Get a conditions object used to wait for a condition on given elements.At least one element must verify the condition to be verified.
- Specified by:
until
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
elements
- elements to wait for- Returns:
- conditions object
-
untilEach
Description copied from interface:FluentWaitConditions
Get a conditions object used to wait for a condition on given elements.Each element must verify the condition to be verified.
- Specified by:
untilEach
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
elements
- elements to wait for- Returns:
- conditions object
-
untilElement
Description copied from interface:FluentWaitConditions
Get a conditions object used to wait for a condition on given element.- Specified by:
untilElement
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
selector
- element to wait for- Returns:
- conditions object
-
untilElements
public FluentListConditions untilElements(Supplier<? extends List<? extends FluentWebElement>> selector) Description copied from interface:FluentWaitConditions
Get a conditions object used to wait for a condition on given elements.At least one element must verify the condition to be verified.
- Specified by:
untilElements
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
selector
- elements to wait for- Returns:
- conditions object
-
untilEachElements
public FluentListConditions untilEachElements(Supplier<? extends List<? extends FluentWebElement>> selector) Description copied from interface:FluentWaitConditions
Get a conditions object used to wait for a condition on given elements.Each element must verify the condition to be verified.
- Specified by:
untilEachElements
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
selector
- elements to wait for- Returns:
- conditions object
-
untilWindow
Description copied from interface:FluentWaitConditions
Get a condition object used to wait for a window condition.- Specified by:
untilWindow
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
windowName
- name of the window to wait for- Returns:
- window conditions object
-
untilPage
Description copied from interface:FluentWaitConditions
Get a condition object used to wait for a page condition.- Specified by:
untilPage
in interfaceFluentWaitConditions<FluentWaitElement>
- Returns:
- page conditions object
-
untilPage
Description copied from interface:FluentWaitConditions
Get a condition object used to wait for a page condition.- Specified by:
untilPage
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
page
- page to wait for- Returns:
- page conditions object
-
explicitlyFor
Description copied from interface:FluentWaitConditions
Waits unconditionally for an explicit amount of time.The method should be used only as a last resort.
In most cases you should wait for some condition, e.g. visibility of particular element on the page.
- Specified by:
explicitlyFor
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
amount
- amount of timetimeUnit
- unit of time- Returns:
this
object to chain method calls
-
untilAsserted
Description copied from interface:FluentWaitConditions
waits until aRunnable
block execution ends without throwing an exception. The method is intended to be used with Java 8 Lambda expressions. This allows to use AssertJ/JUnit/TestNG assertions to periodically check for conditions.await().untilAsserted(() -> assertThat(window().title()).isEqualTo("Fluentlenium"));
- Specified by:
untilAsserted
in interfaceFluentWaitConditions<FluentWaitElement>
- Parameters:
block
- the code block that is responsible for executing the assertion and throwing AssertionError on failure.- Returns:
this
object to chain method calls
-
until
Deprecated.Wait until function returns true- Specified by:
until
in interfaceFluentWaitFunctional<FluentControl>
- Specified by:
until
in interfaceorg.openqa.selenium.support.ui.Wait<FluentControl>
- Type Parameters:
T
- FluentWaitElement- Parameters:
function
- function to be performed- Returns:
- FluentWaitElement
-