pub struct ElementWaiter { /* private fields */ }
Expand description
High-level interface for performing explicit waits using the builder pattern.
§Example:
let elem = driver.query(By::Id("button1")).first().await?;
// Wait until the element is displayed.
elem.wait_until().displayed().await?;
Implementations§
Source§impl ElementWaiter
impl ElementWaiter
Sourcepub fn new(
element: WebElement,
poller: Arc<dyn IntoElementPoller + Send + Sync>,
) -> Self
pub fn new( element: WebElement, poller: Arc<dyn IntoElementPoller + Send + Sync>, ) -> Self
Create a new ElementWaiter
.
See Element::wait_until()
rather than creating this directly.
Sourcepub fn with_poller(
self,
poller: Arc<dyn IntoElementPoller + Send + Sync>,
) -> Self
pub fn with_poller( self, poller: Arc<dyn IntoElementPoller + Send + Sync>, ) -> Self
Use the specified ElementPoller for this ElementWaiter. This will not affect the default ElementPoller used for other waits.
Sourcepub fn error(self, message: &str) -> Self
pub fn error(self, message: &str) -> Self
Provide a human-readable error message to be returned in the case of timeout.
Sourcepub fn ignore_errors(self, ignore: bool) -> Self
pub fn ignore_errors(self, ignore: bool) -> Self
By default, a waiter will ignore any errors that occur while polling for the desired condition(s). However, this behaviour can be modified so that the waiter will return early if an error is returned from thirtyfour.
Sourcepub fn wait(self, timeout: Duration, interval: Duration) -> Self
pub fn wait(self, timeout: Duration, interval: Duration) -> Self
Force this ElementWaiter to wait for the specified timeout, polling once after each interval. This will override the poller for this ElementWaiter only.
Sourcepub async fn condition(self, f: impl ElementPredicate) -> WebDriverResult<()>
pub async fn condition(self, f: impl ElementPredicate) -> WebDriverResult<()>
Wait for the specified condition to be true.
Sourcepub async fn conditions(
self,
conditions: Vec<Box<DynElementPredicate>>,
) -> WebDriverResult<()>
pub async fn conditions( self, conditions: Vec<Box<DynElementPredicate>>, ) -> WebDriverResult<()>
Wait for the specified conditions to be true.
Sourcepub async fn stale(self) -> WebDriverResult<()>
pub async fn stale(self) -> WebDriverResult<()>
Wait for the element to become stale.
Sourcepub async fn displayed(self) -> WebDriverResult<()>
pub async fn displayed(self) -> WebDriverResult<()>
Wait for the element to be displayed.
Sourcepub async fn not_displayed(self) -> WebDriverResult<()>
pub async fn not_displayed(self) -> WebDriverResult<()>
Wait for the element to not be displayed.
Sourcepub async fn selected(self) -> WebDriverResult<()>
pub async fn selected(self) -> WebDriverResult<()>
Wait for the element to be selected.
Sourcepub async fn not_selected(self) -> WebDriverResult<()>
pub async fn not_selected(self) -> WebDriverResult<()>
Wait for the element to not be selected.
Sourcepub async fn enabled(self) -> WebDriverResult<()>
pub async fn enabled(self) -> WebDriverResult<()>
Wait for the element to be enabled.
Sourcepub async fn not_enabled(self) -> WebDriverResult<()>
pub async fn not_enabled(self) -> WebDriverResult<()>
Wait for the element to not be enabled.
Sourcepub async fn clickable(self) -> WebDriverResult<()>
pub async fn clickable(self) -> WebDriverResult<()>
Wait for the element to be clickable.
Sourcepub async fn not_clickable(self) -> WebDriverResult<()>
pub async fn not_clickable(self) -> WebDriverResult<()>
Wait for the element to not be clickable.
Sourcepub async fn has_class<N>(self, class_name: N) -> WebDriverResult<()>
pub async fn has_class<N>(self, class_name: N) -> WebDriverResult<()>
Wait until the element has the specified class.
Sourcepub async fn lacks_class<N>(self, class_name: N) -> WebDriverResult<()>
pub async fn lacks_class<N>(self, class_name: N) -> WebDriverResult<()>
Wait until the element lacks the specified class.
Sourcepub async fn has_text<N>(self, text: N) -> WebDriverResult<()>
pub async fn has_text<N>(self, text: N) -> WebDriverResult<()>
Wait until the element has the specified text.
Sourcepub async fn lacks_text<N>(self, text: N) -> WebDriverResult<()>
pub async fn lacks_text<N>(self, text: N) -> WebDriverResult<()>
Wait until the element lacks the specified text.
Sourcepub async fn has_value<N>(self, value: N) -> WebDriverResult<()>
pub async fn has_value<N>(self, value: N) -> WebDriverResult<()>
Wait until the element has the specified value.
Sourcepub async fn lacks_value<N>(self, value: N) -> WebDriverResult<()>
pub async fn lacks_value<N>(self, value: N) -> WebDriverResult<()>
Wait until the element lacks the specified value.
Sourcepub async fn has_attribute<S, N>(
self,
attribute_name: S,
value: N,
) -> WebDriverResult<()>
pub async fn has_attribute<S, N>( self, attribute_name: S, value: N, ) -> WebDriverResult<()>
Wait until the element has the specified attribute.
Sourcepub async fn lacks_attribute<S, N>(
self,
attribute_name: S,
value: N,
) -> WebDriverResult<()>
pub async fn lacks_attribute<S, N>( self, attribute_name: S, value: N, ) -> WebDriverResult<()>
Wait until the element lacks the specified attribute.
Sourcepub async fn has_attributes<S, N>(
self,
desired_attributes: impl IntoIterator<Item = (S, N)>,
) -> WebDriverResult<()>
pub async fn has_attributes<S, N>( self, desired_attributes: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
Wait until the element has all the specified attributes.
Sourcepub async fn lacks_attributes<S, N>(
self,
desired_attributes: impl IntoIterator<Item = (S, N)>,
) -> WebDriverResult<()>
pub async fn lacks_attributes<S, N>( self, desired_attributes: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
Wait until the element lacks all the specified attributes.
Sourcepub async fn has_property<S, N>(
self,
property_name: S,
value: N,
) -> WebDriverResult<()>
pub async fn has_property<S, N>( self, property_name: S, value: N, ) -> WebDriverResult<()>
Wait until the element has the specified property.
Sourcepub async fn lacks_property<S, N>(
self,
property_name: S,
value: N,
) -> WebDriverResult<()>
pub async fn lacks_property<S, N>( self, property_name: S, value: N, ) -> WebDriverResult<()>
Wait until the element lacks the specified property.
Sourcepub async fn has_properties<S, N>(
self,
desired_properties: impl IntoIterator<Item = (S, N)>,
) -> WebDriverResult<()>
pub async fn has_properties<S, N>( self, desired_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
Wait until the element has all the specified properties.
Sourcepub async fn lacks_properties<S, N>(
self,
desired_properties: impl IntoIterator<Item = (S, N)>,
) -> WebDriverResult<()>
pub async fn lacks_properties<S, N>( self, desired_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
Wait until the element lacks all the specified properties.
Sourcepub async fn has_css_property<S, N>(
self,
css_property_name: S,
value: N,
) -> WebDriverResult<()>
pub async fn has_css_property<S, N>( self, css_property_name: S, value: N, ) -> WebDriverResult<()>
Wait until the element has the specified CSS property.
Sourcepub async fn lacks_css_property<S, N>(
self,
css_property_name: S,
value: N,
) -> WebDriverResult<()>
pub async fn lacks_css_property<S, N>( self, css_property_name: S, value: N, ) -> WebDriverResult<()>
Wait until the element lacks the specified CSS property.
Sourcepub async fn has_css_properties<S, N>(
self,
desired_css_properties: impl IntoIterator<Item = (S, N)>,
) -> WebDriverResult<()>
pub async fn has_css_properties<S, N>( self, desired_css_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
Wait until the element has all the specified CSS properties.
Sourcepub async fn lacks_css_properties<S, N>(
self,
desired_css_properties: impl IntoIterator<Item = (S, N)>,
) -> WebDriverResult<()>
pub async fn lacks_css_properties<S, N>( self, desired_css_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
Wait until the element lacks all the specified CSS properties.