[−][src]Struct chromiumoxide::page::Page
Implementations
impl Page
[src]
pub async fn execute<T: Command, '_>(
&'_ self,
cmd: T
) -> Result<CommandResponse<T::Response>>
[src]
&'_ self,
cmd: T
) -> Result<CommandResponse<T::Response>>
Execute a command and return the Command::Response
pub async fn wait_for_navigation<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
This resolves once the navigation finished and the page is loaded.
This is necessary after an interaction with the page that may trigger a
navigation (click
, press_key
) in order to wait until the new browser
page is loaded
pub async fn goto<'_, '_>(
&'_ self,
params: impl Into<NavigateParams>
) -> Result<&'_ Self>
[src]
&'_ self,
params: impl Into<NavigateParams>
) -> Result<&'_ Self>
Navigate directly to the given URL.
This resolves directly after the requested URL is fully loaded.
pub fn target_id(&self) -> &TargetId
[src]
The identifier of the Target
this page belongs to
pub fn session_id(&self) -> &SessionId
[src]
The identifier of the Session
target of this page is attached to
pub async fn url<'_>(&'_ self) -> Result<Option<String>>
[src]
Returns the current url of the page
pub async fn mainframe<'_>(&'_ self) -> Result<Option<FrameId>>
[src]
Return the main frame of the page
pub async fn set_user_agent<'_, '_>(
&'_ self,
params: impl Into<SetUserAgentOverrideParams>
) -> Result<&'_ Self>
[src]
&'_ self,
params: impl Into<SetUserAgentOverrideParams>
) -> Result<&'_ Self>
Allows overriding user agent with the given string.
pub async fn get_document<'_>(&'_ self) -> Result<Node>
[src]
Returns the root DOM node (and optionally the subtree) of the page.
Note: This does not return the actual HTML document of the page. To
retrieve the HTML content of the page see Page::content
.
pub async fn find_element<'_>(
&'_ self,
selector: impl Into<String>
) -> Result<Element>
[src]
&'_ self,
selector: impl Into<String>
) -> Result<Element>
Returns the first element in the document which matches the given CSS selector.
Execute a query selector on the document's node.
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 describe_node<'_>(&'_ self, node_id: NodeId) -> Result<Node>
[src]
Describes node given its id
pub async fn close(self)
[src]
pub async fn move_mouse_to_point<'_, '_>(
&'_ self,
point: Point
) -> Result<&'_ Self>
[src]
&'_ self,
point: Point
) -> Result<&'_ Self>
Moves the mouse to this point (dispatches a mouseMoved event)
pub async fn click<'_, '_>(&'_ self, point: Point) -> Result<&'_ Self>
[src]
Performs a mouse click event at the point's location.
Bear in mind that if click()
triggers a navigation the new page is not
immediately loaded when click()
resolves. To wait until navigation is
finished an additional wait_for_navigation()
is required:
Example
Trigger a navigation and wait until the triggered navigation is finished
let html = page.click(point).await?.wait_for_navigation().await?.content();
pub async fn pdf<'_>(&'_ self, opts: PrintToPdfParams) -> Result<Vec<u8>>
[src]
Print the current page as pdf.
See PrintToPdfParams
Note Generating a pdf is currently only supported in Chrome headless.
pub async fn save_pdf<'_>(
&'_ self,
opts: PrintToPdfParams,
output: impl AsRef<Path>
) -> Result<Vec<u8>>
[src]
&'_ self,
opts: PrintToPdfParams,
output: impl AsRef<Path>
) -> Result<Vec<u8>>
Save the current page as pdf as file to the output
path and return the
pdf contents.
Note Generating a pdf is currently only supported in Chrome headless.
pub async fn enable_log<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Enables log domain. Enabled by default.
Sends the entries collected so far to the client by means of the entryAdded notification.
See https://chromedevtools.github.io/devtools-protocol/tot/Log#method-enable
pub async fn disable_log<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Disables log domain
Prevents further log entries from being reported to the client
See https://chromedevtools.github.io/devtools-protocol/tot/Log#method-disable
pub async fn enable_runtime<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Enables runtime domain. Activated by default.
pub async fn disable_runtime<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Disables runtime domain
pub async fn enable_debugger<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Enables Debugger. Enabled by default.
pub async fn disable_debugger<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Disables Debugger.
pub async fn activate<'_, '_>(&'_ self) -> Result<&'_ Self>
[src]
Activates (focuses) the target.
pub async fn get_cookies<'_>(&'_ self) -> Result<Vec<Cookie>>
[src]
Returns all cookies that match the tab's current URL.
pub async fn get_title<'_>(&'_ self) -> Result<Option<String>>
[src]
Returns the title of the document.
pub async fn evaluate<'_>(
&'_ self,
evaluate: impl Into<EvaluateParams>
) -> Result<RemoteObject>
[src]
&'_ self,
evaluate: impl Into<EvaluateParams>
) -> Result<RemoteObject>
Evaluates expression on global object.
pub async fn content<'_>(&'_ self) -> Result<String>
[src]
Returns the HTML content of the page
pub async fn get_script_source<'_>(
&'_ self,
script_id: impl Into<String>
) -> Result<String>
[src]
&'_ self,
script_id: impl Into<String>
) -> Result<String>
Returns source for the script with given id.
Debugger must be enabled.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Page
[src]
impl Send for Page
[src]
impl Sync for Page
[src]
impl Unpin for Page
[src]
impl !UnwindSafe for Page
[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>,