pub struct Element {
    pub remote_object_id: RemoteObjectId,
    pub backend_node_id: BackendNodeId,
    pub node_id: NodeId,
    /* private fields */
}
Expand description

Represents a DOM Element.

Fields

remote_object_id: RemoteObjectId

The Unique object identifier

backend_node_id: BackendNodeId

Identifier of the backend node.

node_id: NodeId

The identifier of the node this element represents.

Implementations

Returns the first element in the document which matches the given CSS selector.

Return all Elements in the document that match the given selector

Returns the bounding box of the element (relative to the main frame)

Returns the best Point of this node to execute a click on.

Submits a javascript function to the page and returns the evaluated result

Example get the element as JSON object
    let js_fn = "function() { return this; }";
    let element_json = element.call_js_fn(js_fn, false).await?;
Execute an async javascript function
    let js_fn = "async function() { return this; }";
    let element_json = element.call_js_fn(js_fn, true).await?;

Returns a JSON representation of this element.

Calls focus on the element.

Scrolls the element into view and uses a mouse event to move the mouse over the center of this element.

Scrolls the element into view.

Fails if the element’s node is not a HTML element or is detached from the document

This focuses the element by click on it

Bear in mind that if click() triggers a navigation this element may be not exist anymore.

Type the input

Example type text into an input element
    let element = page.find_element("input#searchInput").await?;
    element.click().await?.type_str("this goes into the input field").await?;

Presses the key.

Example type text into an input element and hit enter
    let element = page.find_element("input#searchInput").await?;
    element.click().await?.type_str("this goes into the input field").await?
         .press_key("Enter").await?;

The description of the element’s node

Attributes of the Element node in the form of flat array `[name1, value1, name2, value2]

Returns the value of the element’s attribute

A Stream over all attributes and their values

The inner text of this element.

The inner HTML of this element.

The outer HTML of this element.

Returns the string property of the element.

If the property is an empty String, None is returned.

Returns the javascript property of this element where property is the name of the requested property of this element.

See also Element::inner_html.

Returns a map with all PropertyDescriptors of this element keyed by their names

Scrolls the element into and takes a screenshot of it

Save a screenshot of the element and write it to output

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.