Struct Element

Source
pub struct Element<'a> { /* private fields */ }
Expand description

Element provides an interface from which to inspect and interact with the requested elements on the page. The general flow involves navigating to your webpage in question, and then requesting a specific element through the query API, and then using the returned element to inspect the element on the page

Implementations§

Source§

impl<'a> Element<'a>

Source

pub fn new( element_id: String, session_id: String, client: &'a Client, ) -> Element<'a>

Source§

impl<'a> Element<'a>

Source

pub fn is_selected(&self) -> Result<bool>

Source

pub fn get_attribute(&self, attribute: &str) -> Result<String>

gets an element attribute for the given element

Source

pub fn get_property(&self, property: &str) -> Result<String>

retrieves the property value for the given element, if it exists

Source

pub fn get_css_value(&self, css_property: &str) -> Result<String>

Gets a css property for the given element, if it exists

Source

pub fn get_text(&self) -> Result<String>

Gets the text for a given element, if it exists or makes sense

Source§

impl<'a> Element<'a>

Source

pub fn click(&self) -> Result<()>

Source

pub fn clear(&self) -> Result<()>

Clears a content editable element’s text value, or returns an error

Source

pub fn type_text(&self, input: &str) -> Result<()>

Tries to type into a content editable element

Trait Implementations§

Source§

impl<'a> Debug for Element<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Element<'a>

§

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

§

impl<'a> Send for Element<'a>

§

impl<'a> Sync for Element<'a>

§

impl<'a> Unpin for Element<'a>

§

impl<'a> !UnwindSafe for Element<'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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

Source§

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