[−][src]Struct headless_chrome::browser::tab::element::Element
A handle to a DOM Element.
Typically you get access to these by passing Tab.wait_for_element
a CSS selector. Once
you have a handle to an element, you can click it, type into it, inspect its
attributes, and more. You can even run a JavaScript function inside the tab which can reference
the element via this
.
Fields
remote_object_id: String
backend_node_id: NodeId
parent: &'a Tab
Methods
impl<'a> Element<'a>
[src]
pub fn new(parent: &'a Tab, node_id: NodeId) -> Fallible<Self>
[src]
Using a 'node_id', of the type returned by QuerySelector and QuerySelectorAll, this finds the 'backend_node_id' and 'remote_object_id' which are stable identifiers, unlike node_id. We use these two when making various calls to the API because of that.
pub fn move_mouse_over(&self) -> Fallible<&Self>
[src]
Moves the mouse to the middle of this element
pub fn click(&self) -> Fallible<&Self>
[src]
pub fn type_into(&self, text: &str) -> Fallible<&Self>
[src]
pub fn call_js_fn(
&self,
function_declaration: &str,
await_promise: bool
) -> Fallible<RemoteObject>
[src]
&self,
function_declaration: &str,
await_promise: bool
) -> Fallible<RemoteObject>
pub fn focus(&self) -> Fallible<&Self>
[src]
pub fn get_description(&self) -> Fallible<Node>
[src]
pub fn capture_screenshot(&self, format: ScreenshotFormat) -> Fallible<Vec<u8>>
[src]
Capture a screenshot of this element.
The screenshot is taken from the surface using this element's content-box.
use headless_chrome::{protocol::page::ScreenshotFormat, Browser, LaunchOptionsBuilder}; let browser = Browser::new(LaunchOptionsBuilder::default().build().unwrap())?; let png_data = browser.wait_for_initial_tab()? .navigate_to("https://en.wikipedia.org/wiki/WebKit")? .wait_for_element("#mw-content-text > div > table.infobox.vevent")? .capture_screenshot(ScreenshotFormat::PNG)?;
pub fn set_input_files(&self, file_paths: &[&str]) -> Fallible<&Self>
[src]
pub fn scroll_into_view(&self) -> Fallible<&Self>
[src]
Scrolls the current element into view
Used prior to any action applied to the current element to ensure action is duable.
pub fn get_attributes(&self) -> Fallible<Option<NodeAttributes>>
[src]
pub fn get_box_model(&self) -> Fallible<BoxModel>
[src]
Get boxes for this element
pub fn get_midpoint(&self) -> Fallible<Point>
[src]
pub fn get_js_midpoint(&self) -> Fallible<Point>
[src]
Trait Implementations
Auto Trait Implementations
impl<'a> Send for Element<'a>
impl<'a> Unpin for Element<'a>
impl<'a> Sync for Element<'a>
impl<'a> UnwindSafe for Element<'a>
impl<'a> RefUnwindSafe for Element<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> Typeable for T where
T: Any,
T: Any,