[][src]Struct thirtyfour_query::ElementQuery

pub struct ElementQuery<'a> { /* fields omitted */ }

High-level interface for performing powerful element queries using a builder pattern.

Example:

// Disable implicit timeout in order to use new query interface.
driver.set_implicit_wait_timeout(Duration::new(0, 0)).await?;

let poller = ElementPoller::TimeoutWithInterval(Duration::new(10, 0), Duration::from_millis(500));
driver.config_mut().set("ElementPoller", poller)?;

driver.get("http://webappdemo").await?;

let elem = driver.query(By::Id("button1")).first().await?;

Implementations

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

pub fn with_poller(self, poller: ElementPoller) -> Self[src]

Use the specified ElementPoller for this ElementQuery. This will not affect the default ElementPoller used for other queries.

pub fn wait(self, timeout: Duration, interval: Duration) -> Self[src]

Force this ElementQuery to wait for the specified timeout, polling once after each interval. This will override the poller for this ElementQuery only.

pub fn nowait(self) -> Self[src]

Force this ElementQuery to not wait for the specified condition(s). This will override the poller for this ElementQuery only.

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

Add a new selector to this ElementQuery. All conditions specified after this selector (up until the next or() method) will apply to this selector.

pub async fn exists(&self) -> WebDriverResult<bool>[src]

Return true if an element matches any selector, otherwise false.

pub async fn not_exists(&self) -> WebDriverResult<bool>[src]

Return true if no element matches any selector, otherwise false.

pub async fn first(&self) -> WebDriverResult<WebElement<'a>>[src]

Return only the first WebElement that matches any selector (including all of the filters for that selector).

pub async fn all(&self) -> WebDriverResult<Vec<WebElement<'a>>>[src]

Return all WebElements that match any one selector (including all of the filters for that selector).

Returns an empty Vec if no elements match.

pub async fn all_required(&self) -> WebDriverResult<Vec<WebElement<'a>>>[src]

Return all WebElements that match any one selector (including all of the filters for that selector).

Returns Err(WebDriverError::NoSuchElement) if no elements match.

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

Add the specified ElementPredicate to the last selector.

pub fn with_single_selector(self) -> Self[src]

Set the previous selector to only return the first matched element. WARNING: Use with caution! This can result in faster lookups, but will probably break any filters on this selector.

If you are simply want to get the first element after filtering from a list, use the first() method instead.

pub fn and_enabled(self) -> Self[src]

Only match elements that are enabled.

pub fn and_not_enabled(self) -> Self[src]

Only match elements that are NOT enabled.

pub fn and_selected(self) -> Self[src]

Only match elements that are selected.

pub fn and_not_selected(self) -> Self[src]

Only match elements that are NOT selected.

pub fn and_displayed(self) -> Self[src]

Only match elements that are displayed.

pub fn and_not_displayed(self) -> Self[src]

Only match elements that are NOT displayed.

pub fn and_clickable(self) -> Self[src]

Only match elements that are clickable.

pub fn and_not_clickable(self) -> Self[src]

Only match elements that are NOT clickable.

pub fn with_text<N>(self, text: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified text. See the Needle documentation for more details on text matching rules.

pub fn with_id<N>(self, id: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified id. See the Needle documentation for more details on text matching rules.

pub fn with_class<N>(self, class_name: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified class name. See the Needle documentation for more details on text matching rules.

pub fn with_tag<N>(self, tag_name: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified tag. See the Needle documentation for more details on text matching rules.

pub fn with_value<N>(self, value: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified value. See the Needle documentation for more details on text matching rules.

pub fn with_attribute<N>(self, attribute_name: &str, value: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified attribute with the specified value. See the Needle documentation for more details on text matching rules.

pub fn with_attributes<N>(
    self,
    desired_attributes: &'static [(String, N)]
) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified attributes with the specified values. See the Needle documentation for more details on text matching rules.

pub fn with_property<N>(self, property_name: &str, value: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified property with the specified value. See the Needle documentation for more details on text matching rules.

pub fn with_properties<N>(
    self,
    desired_properties: &'static [(&str, N)]
) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified properties with the specified value. See the Needle documentation for more details on text matching rules.

pub fn with_css_property<N>(self, css_property_name: &str, value: N) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified CSS property with the specified value. See the Needle documentation for more details on text matching rules.

pub fn with_css_properties<N>(
    self,
    desired_css_properties: &'static [(&str, N)]
) -> Self where
    N: Needle + Clone + Send + Sync + 'static, 
[src]

Only match elements that have the specified CSS properties with the specified values. See the Needle documentation for more details on text matching rules.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ElementQuery<'a>[src]

impl<'a> Send for ElementQuery<'a>[src]

impl<'a> Sync for ElementQuery<'a>[src]

impl<'a> Unpin for ElementQuery<'a>[src]

impl<'a> !UnwindSafe for ElementQuery<'a>[src]

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> Instrument for T[src]

impl<T> Instrument 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.