pub struct CdpClient { /* private fields */ }Expand description
Low-level HTTP client for the Chrome DevTools Protocol JSON endpoints.
§Security
The CDP port (http://127.0.0.1:<port>) is accessible to all local
processes. Any program running on the same host can list targets, attach
debuggers, and execute arbitrary JavaScript in browser contexts. In
production deployments, callers should consider firewall rules or network
namespaces to restrict access to the CDP port.
Implementations§
Source§impl CdpClient
impl CdpClient
pub fn new(port: u16) -> Result<Self>
pub fn next_id(&self) -> u64
pub fn build_command(&self, method: &str, params: Value) -> Value
pub async fn list_targets(&self) -> Result<Vec<CdpTarget>>
pub async fn new_tab(&self, url: &str) -> Result<CdpTarget>
pub async fn close_tab(&self, target_id: &str) -> Result<()>
pub async fn version(&self) -> Result<Value>
pub fn evaluate_command(&self, expression: &str) -> Value
pub fn screenshot_command(&self) -> Value
pub fn get_document_command(&self) -> Value
pub fn click_command(&self, x: f64, y: f64) -> Value
pub fn type_text_command(&self, text: &str) -> Value
pub fn pdf_command(&self) -> Value
Auto Trait Implementations§
impl !Freeze for CdpClient
impl !RefUnwindSafe for CdpClient
impl Send for CdpClient
impl Sync for CdpClient
impl Unpin for CdpClient
impl UnsafeUnpin for CdpClient
impl !UnwindSafe 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