Dom

Struct Dom 

Source
pub struct Dom<T: HttpTransport> { /* private fields */ }
Expand description

Structure for manipulating HTML documents

Implementations§

Source§

impl<T: HttpTransport> Dom<T>

Source

pub fn new(transport: T) -> Self

Create a new Dom instance

Source

pub fn parse(self, html: String) -> Result<Self>

Parse HTML and return a Dom instance

Source

pub fn form(&self, locator: &str) -> Result<Form<T>>

Get a form

Source

pub fn button(&self, locator: &str) -> Result<Button<T>>

Get a button

Get a link

Source

pub fn element(&self, locator: &str) -> Result<Element>

Get an element

Source

pub fn elements(&self, locator: &str) -> Vec<Element>

Get multiple elements

Source

pub fn text(&self, locator: &str) -> Result<String>

Get the text of an element

Source

pub fn texts(&self, locator: &str) -> Vec<String>

Get the text of multiple elements

Source

pub fn inner_html(&self, locator: &str) -> Result<String>

Get the inner HTML of an element

Source

pub fn table(&self, locator: &str) -> Result<Table>

Get a table

Source

pub fn list(&self, locator: &str) -> Result<List>

Get a list

Source

pub fn exists(&self, locator: &str) -> bool

Check if an element exists

Source

pub fn contains_text(&self, text: &str) -> bool

Check if an element containing the specified text exists

Source

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

Get the content of the title tag

Source

pub fn meta(&self, name: &str) -> Result<String>

Get the content attribute of a meta tag

Source

pub fn image(&self, locator: &str) -> Result<Image>

Get an image

Source

pub fn images(&self, locator: &str) -> Vec<Image>

Get multiple images

Source

pub fn select_element(&self, locator: &str) -> Result<SelectElement>

Get a select element

Auto Trait Implementations§

§

impl<T> Freeze for Dom<T>

§

impl<T> RefUnwindSafe for Dom<T>
where T: RefUnwindSafe,

§

impl<T> Send for Dom<T>

§

impl<T> Sync for Dom<T>

§

impl<T> Unpin for Dom<T>

§

impl<T> UnwindSafe for Dom<T>
where T: RefUnwindSafe,

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, 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.