pub struct CdpClient { /* private fields */ }Implementations§
Source§impl CdpClient
impl CdpClient
pub async fn connect(ws_url: &str) -> Result<Self>
Sourcepub fn set_command_timeout(&self, timeout: Duration)
pub fn set_command_timeout(&self, timeout: Duration)
Set the per-command timeout applied to every send_command
call. Passing a zero duration disables the timeout (commands wait indefinitely).
Sourcepub fn command_timeout(&self) -> Duration
pub fn command_timeout(&self) -> Duration
The current per-command timeout.
pub fn subscribe_events(&self) -> Receiver<(String, Value)>
pub async fn wait_for_event( &self, method: &str, timeout_ms: u64, ) -> Result<Value>
pub async fn enable_domain(&self, domain: &str) -> Result<()>
pub async fn eval(&self, expression: &str) -> Result<String>
pub async fn evaluate(&self, expression: &str) -> Result<EvaluateResult>
pub async fn get_document(&self) -> Result<DocumentNode>
Sourcepub async fn query_selector(
&self,
node_id: i64,
selector: &str,
) -> Result<Option<i64>>
pub async fn query_selector( &self, node_id: i64, selector: &str, ) -> Result<Option<i64>>
Returns the matched nodeId, or None when nothing matches.
CDP reports a missing match as nodeId 0; this surfaces that as None
rather than a node id that looks valid.
pub async fn get_outer_html(&self, node_id: i64) -> Result<String>
pub async fn close(&self) -> Result<()>
pub async fn screenshot(&self) -> Result<Vec<u8>>
pub async fn screenshot_to_file(&self, path: &str) -> Result<()>
pub async fn full_page_screenshot(&self) -> Result<Vec<u8>>
pub async fn full_page_screenshot_to_file(&self, path: &str) -> Result<()>
pub async fn set_viewport( &self, width: i32, height: i32, mobile: bool, ) -> Result<()>
pub async fn get_version(host: &str, port: u16) -> Result<BrowserVersion>
pub async fn list_targets(host: &str, port: u16) -> Result<Vec<Target>>
pub async fn connect_to_page(host: &str, port: u16) -> Result<Self>
pub async fn create_tab( host: &str, port: u16, url: Option<&str>, ) -> Result<Target>
Source§impl CdpClient
impl CdpClient
pub async fn set_extra_headers( &self, headers: &HashMap<String, String>, ) -> Result<()>
pub async fn block_urls(&self, patterns: &[&str]) -> Result<()>
pub async fn get_response_body(&self, request_id: &str) -> Result<String>
pub async fn intercept_requests(&self, url_patterns: &[&str]) -> Result<()>
pub async fn continue_request(&self, request_id: &str) -> Result<()>
pub async fn fulfill_request( &self, request_id: &str, status: u16, body: &str, content_type: &str, ) -> Result<()>
Source§impl CdpClient
impl CdpClient
pub async fn set_content(&self, html: &str) -> Result<()>
pub async fn print_to_pdf(&self, path: &str) -> Result<()>
pub async fn add_init_script(&self, source: &str) -> Result<String>
pub async fn remove_init_script(&self, identifier: &str) -> Result<()>
pub async fn set_user_agent(&self, ua: &str) -> Result<()>
pub async fn set_geolocation( &self, latitude: f64, longitude: f64, accuracy: f64, ) -> Result<()>
pub async fn set_offline(&self, offline: bool) -> Result<()>
pub async fn set_attribute( &self, node_id: i64, name: &str, value: &str, ) -> Result<()>
pub async fn set_outer_html(&self, node_id: i64, html: &str) -> Result<()>
pub async fn remove_node(&self, node_id: i64) -> Result<()>
pub async fn call_function_on( &self, object_id: &str, function_declaration: &str, ) -> Result<Value>
Auto Trait Implementations§
impl !RefUnwindSafe for CdpClient
impl !UnwindSafe for CdpClient
impl Freeze for CdpClient
impl Send for CdpClient
impl Sync for CdpClient
impl Unpin for CdpClient
impl UnsafeUnpin for CdpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more