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>
impl<T: Clone> ElementResolver<T>
Sourcepub async fn resolve(&self) -> WebDriverResult<T>
pub async fn resolve(&self) -> WebDriverResult<T>
Return the cached element(s) if any, otherwise run the query and return the result.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Invalidate any cached element(s).
Sourcepub async fn resolve_force(&self) -> Option<T>
pub async fn resolve_force(&self) -> Option<T>
Run the query, ignoring any cached element(s).
Source§impl ElementResolver<WebElement>
impl ElementResolver<WebElement>
Sourcepub fn new_single(base_element: WebElement, by: By) -> Self
pub fn new_single(base_element: WebElement, by: By) -> Self
Create new element resolver that must return a single element.
Sourcepub fn new_single_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_first(base_element: WebElement, by: By) -> Self
pub fn new_first(base_element: WebElement, by: By) -> Self
Create new element resolver that returns the first element.
Sourcepub fn new_first_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_custom(
base_element: WebElement,
custom_resolver_fn: ElementQueryFn<WebElement>,
) -> Self
pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<WebElement>, ) -> Self
Create new element resolver using custom resolver function.
Sourcepub async fn validate(&self) -> WebDriverResult<Option<WebElement>>
pub async fn validate(&self) -> WebDriverResult<Option<WebElement>>
Validate that the cached element is present, and if so, return it.
Sourcepub async fn resolve_present(&self) -> WebDriverResult<WebElement>
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>>
impl ElementResolver<Vec<WebElement>>
Sourcepub fn new_allow_empty(base_element: WebElement, by: By) -> Self
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.
Sourcepub fn new_allow_empty_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_not_empty(base_element: WebElement, by: By) -> Self
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.
Sourcepub fn new_not_empty_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_custom(
base_element: WebElement,
custom_resolver_fn: ElementQueryFn<Vec<WebElement>>,
) -> Self
pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<Vec<WebElement>>, ) -> Self
Create new multi element resolver using a custom resolver function.
Sourcepub async fn validate(&self) -> WebDriverResult<Option<Vec<WebElement>>>
pub async fn validate(&self) -> WebDriverResult<Option<Vec<WebElement>>>
Validate that all cached elements are present, if any.
Sourcepub async fn resolve_present(&self) -> WebDriverResult<Vec<WebElement>>
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>
impl<T: Component + Clone> ElementResolver<T>
Sourcepub fn new_single(base_element: WebElement, by: By) -> Self
pub fn new_single(base_element: WebElement, by: By) -> Self
Create new element resolver that must return a single component.
Sourcepub fn new_single_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_first(base_element: WebElement, by: By) -> Self
pub fn new_first(base_element: WebElement, by: By) -> Self
Create new element resolver that returns the first component.
Sourcepub fn new_first_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_custom(
base_element: WebElement,
custom_resolver_fn: ElementQueryFn<T>,
) -> Self
pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<T>, ) -> Self
Create new component resolver using custom resolver function.
Sourcepub async fn validate(&self) -> WebDriverResult<Option<T>>
pub async fn validate(&self) -> WebDriverResult<Option<T>>
Validate that the cached component is present, and if so, return it.
Sourcepub async fn resolve_present(&self) -> WebDriverResult<T>
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>>
impl<T: Component + Clone> ElementResolver<Vec<T>>
Sourcepub fn new_allow_empty(base_element: WebElement, by: By) -> Self
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.
Sourcepub fn new_allow_empty_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_not_empty(base_element: WebElement, by: By) -> Self
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.
Sourcepub fn new_not_empty_opts(
base_element: WebElement,
by: By,
options: ElementQueryOptions,
) -> Self
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.
Sourcepub fn new_custom(
base_element: WebElement,
custom_resolver_fn: ElementQueryFn<Vec<T>>,
) -> Self
pub fn new_custom( base_element: WebElement, custom_resolver_fn: ElementQueryFn<Vec<T>>, ) -> Self
Create new multi component resolver using a custom resolver function.
Sourcepub async fn validate(&self) -> WebDriverResult<Option<Vec<T>>>
pub async fn validate(&self) -> WebDriverResult<Option<Vec<T>>>
Validate that all cached components are present, if any.
Sourcepub async fn resolve_present(&self) -> WebDriverResult<Vec<T>>
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.