[−][src]Struct chromiumoxide::element::Element
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
impl Element
[src]
pub async fn find_element<'_>(
&'_ self,
selector: impl Into<String>
) -> Result<Self>
[src]
&'_ self,
selector: impl Into<String>
) -> Result<Self>
Returns the first element in the document which matches the given CSS selector.
pub async fn find_elements<'_>(
&'_ self,
selector: impl Into<String>
) -> Result<Vec<Element>>
[src]
&'_ self,
selector: impl Into<String>
) -> Result<Vec<Element>>
Return all Element
s in the document that match the given selector
pub async fn clickable_point<'_>(&'_ self) -> Result<Point>
[src]
Returns the best Point
of this node to execute a click on.
pub async fn call_js_fn<'_>(
&'_ self,
function_declaration: impl Into<String>,
await_promise: bool
) -> Result<CallFunctionOnReturns>
[src]
&'_ self,
function_declaration: impl Into<String>,
await_promise: bool
) -> Result<CallFunctionOnReturns>
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?;
pub async fn scroll_into_view<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Scrolls the element into view.
Fails if the element's node is not a HTML element or is detached from the document
pub async fn click<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
This focuses the element by click on it
Bear in mind that if click()
triggers a navigation this element may be
not exist anymore.
pub async fn type_str<'_, '_>(
&'_ self,
input: impl AsRef<str>
) -> Result<&'_ Self>
[src]
&'_ self,
input: impl AsRef<str>
) -> Result<&'_ Self>
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?;
pub async fn press_key<'_, '_>(
&'_ self,
key: impl AsRef<str>
) -> Result<&'_ Self>
[src]
&'_ self,
key: impl AsRef<str>
) -> Result<&'_ Self>
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?;
pub async fn description<'_>(&'_ self) -> Result<Node>
[src]
The description of the element's node
pub async fn attributes<'_>(&'_ self) -> Result<Vec<String>>
[src]
Attributes of the Element
node in the form of flat array `[name1,
value1, name2, value2]
pub async fn attribute<'_>(
&'_ self,
attribute: impl AsRef<str>
) -> Result<Option<String>>
[src]
&'_ self,
attribute: impl AsRef<str>
) -> Result<Option<String>>
Returns the value of the element's attribute
pub async fn iter_attributes<'_, '_>(
&'_ self
) -> Result<impl Stream<Item = (String, Result<Option<String>>)> + '_>
[src]
&'_ self
) -> Result<impl Stream<Item = (String, Result<Option<String>>)> + '_>
A Stream
over all attributes and their values
pub async fn inner_text<'_>(&'_ self) -> Result<Option<String>>
[src]
The inner text of this element.
pub async fn inner_html<'_>(&'_ self) -> Result<Option<String>>
[src]
The inner HTML of this element.
pub async fn outer_html<'_>(&'_ self) -> Result<Option<String>>
[src]
The outer HTML of this element.
pub async fn string_property<'_>(
&'_ self,
property: impl AsRef<str>
) -> Result<Option<String>>
[src]
&'_ self,
property: impl AsRef<str>
) -> Result<Option<String>>
Returns the string property of the element.
If the property is an empty String, None
is returned.
pub async fn property<'_>(
&'_ self,
property: impl AsRef<str>
) -> Result<Option<Value>>
[src]
&'_ self,
property: impl AsRef<str>
) -> Result<Option<Value>>
Returns the javascript property
of this element
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Element
[src]
impl Send for Element
[src]
impl Sync for Element
[src]
impl Unpin for Element
[src]
impl !UnwindSafe for Element
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,