[][src]Struct thirtyfour_query::ElementSelector

pub struct ElementSelector<'a> {
    pub single: bool,
    pub by: By<'a>,
    pub filters: Vec<Box<dyn Fn(&'a WebElement<'a>) -> Pin<Box<dyn Future<Output = bool> + Send + 'a>> + Send + Sync + 'static>>,
}

An ElementSelector contains a selector method (By) as well as zero or more filters. The filters will be applied to any elements matched by the selector. Selectors and filters all run in full on every poll iteration.

Fields

single: bool

If false (default), find_elements() will be used. If true, find_element() will be used instead. See notes below for with_single_selector() for potential pitfalls.

by: By<'a>filters: Vec<Box<dyn Fn(&'a WebElement<'a>) -> Pin<Box<dyn Future<Output = bool> + Send + 'a>> + Send + Sync + 'static>>

Implementations

impl<'a> ElementSelector<'a>[src]

pub fn new(by: By<'a>) -> Self[src]

pub fn set_single(&mut self)[src]

Call set_single() to tell this selector to use find_element() rather than find_elements(). This can be slightly faster but only really makes sense if (1) you're not using any filters and (2) you're only interested in the first element matched anyway.

pub fn add_filter(
    &mut self,
    f: Box<dyn Fn(&'a WebElement<'a>) -> Pin<Box<dyn Future<Output = bool> + Send + 'a>> + Send + Sync + 'static>
)
[src]

Add the specified filter to the list of filters for this selector.

pub async fn run_filters<'b, '_>(
    &'_ self,
    elements: Vec<WebElement<'b>>
) -> Vec<WebElement<'b>>
[src]

Run all filters for this selector on the specified WebElement vec.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ElementSelector<'a>

impl<'a> Send for ElementSelector<'a>

impl<'a> Sync for ElementSelector<'a>

impl<'a> Unpin for ElementSelector<'a>

impl<'a> !UnwindSafe for ElementSelector<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.