Struct ElementWaiter

Source
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

Source

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.

Source

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.

Source

pub fn error(self, message: &str) -> Self

Provide a human-readable error message to be returned in the case of timeout.

Source

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.

Source

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.

Source

pub async fn condition(self, f: impl ElementPredicate) -> WebDriverResult<()>

Wait for the specified condition to be true.

Source

pub async fn conditions( self, conditions: Vec<Box<DynElementPredicate>>, ) -> WebDriverResult<()>

Wait for the specified conditions to be true.

Source

pub async fn stale(self) -> WebDriverResult<()>

Wait for the element to become stale.

Source

pub async fn displayed(self) -> WebDriverResult<()>

Wait for the element to be displayed.

Source

pub async fn not_displayed(self) -> WebDriverResult<()>

Wait for the element to not be displayed.

Source

pub async fn selected(self) -> WebDriverResult<()>

Wait for the element to be selected.

Source

pub async fn not_selected(self) -> WebDriverResult<()>

Wait for the element to not be selected.

Source

pub async fn enabled(self) -> WebDriverResult<()>

Wait for the element to be enabled.

Source

pub async fn not_enabled(self) -> WebDriverResult<()>

Wait for the element to not be enabled.

Source

pub async fn clickable(self) -> WebDriverResult<()>

Wait for the element to be clickable.

Source

pub async fn not_clickable(self) -> WebDriverResult<()>

Wait for the element to not be clickable.

Source

pub async fn has_class<N>(self, class_name: N) -> WebDriverResult<()>
where N: Needle + Clone + Send + Sync + 'static,

Wait until the element has the specified class.

Source

pub async fn lacks_class<N>(self, class_name: N) -> WebDriverResult<()>
where N: Needle + Clone + Send + Sync + 'static,

Wait until the element lacks the specified class.

Source

pub async fn has_text<N>(self, text: N) -> WebDriverResult<()>
where N: Needle + Clone + Send + Sync + 'static,

Wait until the element has the specified text.

Source

pub async fn lacks_text<N>(self, text: N) -> WebDriverResult<()>
where N: Needle + Clone + Send + Sync + 'static,

Wait until the element lacks the specified text.

Source

pub async fn has_value<N>(self, value: N) -> WebDriverResult<()>
where N: Needle + Clone + Send + Sync + 'static,

Wait until the element has the specified value.

Source

pub async fn lacks_value<N>(self, value: N) -> WebDriverResult<()>
where N: Needle + Clone + Send + Sync + 'static,

Wait until the element lacks the specified value.

Source

pub async fn has_attribute<S, N>( self, attribute_name: S, value: N, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Clone + Send + Sync + 'static,

Wait until the element has the specified attribute.

Source

pub async fn lacks_attribute<S, N>( self, attribute_name: S, value: N, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Clone + Send + Sync + 'static,

Wait until the element lacks the specified attribute.

Source

pub async fn has_attributes<S, N>( self, desired_attributes: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Send + Sync + 'static,

Wait until the element has all the specified attributes.

Source

pub async fn lacks_attributes<S, N>( self, desired_attributes: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Send + Sync + 'static,

Wait until the element lacks all the specified attributes.

Source

pub async fn has_property<S, N>( self, property_name: S, value: N, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Clone + Send + Sync + 'static,

Wait until the element has the specified property.

Source

pub async fn lacks_property<S, N>( self, property_name: S, value: N, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Clone + Send + Sync + 'static,

Wait until the element lacks the specified property.

Source

pub async fn has_properties<S, N>( self, desired_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Send + Sync + 'static,

Wait until the element has all the specified properties.

Source

pub async fn lacks_properties<S, N>( self, desired_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Send + Sync + 'static,

Wait until the element lacks all the specified properties.

Source

pub async fn has_css_property<S, N>( self, css_property_name: S, value: N, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Clone + Send + Sync + 'static,

Wait until the element has the specified CSS property.

Source

pub async fn lacks_css_property<S, N>( self, css_property_name: S, value: N, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Clone + Send + Sync + 'static,

Wait until the element lacks the specified CSS property.

Source

pub async fn has_css_properties<S, N>( self, desired_css_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Send + Sync + 'static,

Wait until the element has all the specified CSS properties.

Source

pub async fn lacks_css_properties<S, N>( self, desired_css_properties: impl IntoIterator<Item = (S, N)>, ) -> WebDriverResult<()>
where S: IntoArcStr, N: Needle + Send + Sync + 'static,

Wait until the element lacks all the specified CSS properties.

Trait Implementations§

Source§

impl Debug for ElementWaiter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more