ElementSelector

Struct ElementSelector 

Source
pub struct ElementSelector<'a> {
    pub single: bool,
    pub by: By<'a>,
    pub filters: Vec<ElementPredicate>,
}
Expand description

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

Implementations§

Source§

impl<'a> ElementSelector<'a>

Source

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

Source

pub fn set_single(&mut self)

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.

Source

pub fn add_filter(&mut self, f: ElementPredicate)

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

Source

pub async fn run_filters<'b>( &self, elements: Vec<WebElement<'b>>, ) -> WebDriverResult<Vec<WebElement<'b>>>

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

Auto Trait Implementations§

§

impl<'a> Freeze for ElementSelector<'a>

§

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§

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,