pub struct ElementResolver<T: Clone> { /* private fields */ }
Expand description

Element resolver that can resolve a particular element or list of elements on demand.

Once resolved, the result will be cached for later retrieval until manually invalidated.

Implementations§

source§

impl<T: Clone> ElementResolver<T>

source

pub async fn resolve(&self) -> WebDriverResult<T>

Return the cached element(s) if any, otherwise run the query and return the result.

source

pub fn invalidate(&self)

Invalidate any cached element(s).

source

pub async fn resolve_force(&self) -> Option<T>

Run the query, ignoring any cached element(s).

source§

impl ElementResolver<WebElement>

source

pub fn new_single(base_element: WebElement, by: By) -> Self

Create new element resolver that must return a single element.

source

pub fn new_single_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that must return a single element, with extra options.

source

pub fn new_first(base_element: WebElement, by: By) -> Self

Create new element resolver that returns the first element.

source

pub fn new_first_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that returns the first element, with extra options.

source

pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<WebElement> ) -> Self

Create new element resolver using custom resolver function.

source

pub async fn validate(&self) -> WebDriverResult<Option<WebElement>>

Validate that the cached element is present, and if so, return it.

source

pub async fn resolve_present(&self) -> WebDriverResult<WebElement>

Validate the element and repeat the query if it is not present, returning the result.

If the element is already present, the cached element will be returned without performing an additional query.

source§

impl ElementResolver<Vec<WebElement>>

source

pub fn new_allow_empty(base_element: WebElement, by: By) -> Self

Create new element resolver that returns all elements, if any.

If no elements were found, this will resolve to an empty Vec.

source

pub fn new_allow_empty_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that returns all elements (if any), with extra options.

source

pub fn new_not_empty(base_element: WebElement, by: By) -> Self

Create new element resolver that returns at least one element.

If no elements were found, a NoSuchElement error will be returned by the resolver’s resolve() method.

source

pub fn new_not_empty_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that returns at least one element, with extra options.

If no elements were found, a NoSuchElement error will be returned by the resolver’s resolve() method.

source

pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<Vec<WebElement>> ) -> Self

Create new multi element resolver using a custom resolver function.

source

pub async fn validate(&self) -> WebDriverResult<Option<Vec<WebElement>>>

Validate that all cached elements are present, if any.

source

pub async fn resolve_present(&self) -> WebDriverResult<Vec<WebElement>>

Validate all elements and repeat the query if any are not present, returning the results.

If all elements are already present, the cached elements will be returned without performing an additional query.

source§

impl<T: Component + Clone> ElementResolver<T>

source

pub fn new_single(base_element: WebElement, by: By) -> Self

Create new element resolver that must return a single component.

source

pub fn new_single_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that must return a single component, with extra options.

source

pub fn new_first(base_element: WebElement, by: By) -> Self

Create new element resolver that returns the first component.

source

pub fn new_first_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that returns the first component, with extra options.

source

pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<T> ) -> Self

Create new component resolver using custom resolver function.

source

pub async fn validate(&self) -> WebDriverResult<Option<T>>

Validate that the cached component is present, and if so, return it.

source

pub async fn resolve_present(&self) -> WebDriverResult<T>

Validate the component and repeat the query if it is not present, returning the result.

If the component is already present, the cached component will be returned without performing an additional query.

source§

impl<T: Component + Clone> ElementResolver<Vec<T>>

source

pub fn new_allow_empty(base_element: WebElement, by: By) -> Self

Create new element resolver that returns all components, if any.

If no components were found, this will resolve to an empty Vec.

source

pub fn new_allow_empty_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that returns all components (if any), with extra options.

source

pub fn new_not_empty(base_element: WebElement, by: By) -> Self

Create new element resolver that returns at least one component.

If no components were found, a NoSuchElement error will be returned by the resolver’s resolve() method.

source

pub fn new_not_empty_opts( base_element: WebElement, by: By, options: ElementQueryOptions ) -> Self

Create new element resolver that returns at least one component, with extra options.

If no components were found, a NoSuchElement error will be returned by the resolver’s resolve() method.

source

pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<Vec<T>> ) -> Self

Create new multi component resolver using a custom resolver function.

source

pub async fn validate(&self) -> WebDriverResult<Option<Vec<T>>>

Validate that all cached components are present, if any.

source

pub async fn resolve_present(&self) -> WebDriverResult<Vec<T>>

Validate all components and repeat the query if any are not present, returning the results.

If all components are already present, the cached components will be returned without performing an additional query.

Trait Implementations§

source§

impl<T: Clone> Clone for ElementResolver<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + Clone> Debug for ElementResolver<T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ElementResolver<T>

§

impl<T> !RefUnwindSafe for ElementResolver<T>

§

impl<T> Send for ElementResolver<T>
where T: Send,

§

impl<T> Sync for ElementResolver<T>
where T: Send,

§

impl<T> Unpin for ElementResolver<T>

§

impl<T> !UnwindSafe for ElementResolver<T>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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