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: boolIf 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>
impl<'a> ElementSelector<'a>
pub fn new(by: By<'a>) -> Self
Sourcepub fn set_single(&mut self)
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.
Sourcepub fn add_filter(&mut self, f: ElementPredicate)
pub fn add_filter(&mut self, f: ElementPredicate)
Add the specified filter to the list of filters for this selector.
Sourcepub async fn run_filters<'b>(
&self,
elements: Vec<WebElement<'b>>,
) -> WebDriverResult<Vec<WebElement<'b>>>
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.