pub struct CdpConnection { /* private fields */ }
Expand description
A connection to the browser isntance which can be used to send and recieve messages The connection connection will be closed when the variable is dropped
Implementations§
Source§impl CdpConnection
impl CdpConnection
Sourcepub fn send(
&mut self,
method: &'static str,
parms: Vec<(&'static str, MessageParameter)>,
) -> Result<Value, MessageError>
pub fn send( &mut self, method: &'static str, parms: Vec<(&'static str, MessageParameter)>, ) -> Result<Value, MessageError>
Sends a message to the browser instance with the supplied parameters
§Examples
let mut cdp = CdpClient::new().connect_to_tab(0);
cdp.send("Network.getCookies", parms!("urls", vec!["https://www.google.com"]));
Sourcepub fn wait_message(&mut self) -> Result<Value, MessageError>
pub fn wait_message(&mut self) -> Result<Value, MessageError>
Waits for the next message to be recieved. Will return NoMessage if there are no messages available
§Examples
let mut cdp = CdpClient::new().connect_to_tab(0);
let response = cdp.wait_message();
Sourcepub fn wait_event(
&mut self,
event: &str,
timeout: Option<Duration>,
) -> Result<Value, MessageError>
pub fn wait_event( &mut self, event: &str, timeout: Option<Duration>, ) -> Result<Value, MessageError>
Waits for the specified event before returning. Will block until the event is found.
§Examples
let mut cdp = CdpClient::new().connect_to_tab(0);
cdp.send("Network.enable", parms!()).unwrap();
let response = cdp.wait_event("Network.dataReceived", None);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CdpConnection
impl RefUnwindSafe for CdpConnection
impl Send for CdpConnection
impl Sync for CdpConnection
impl Unpin for CdpConnection
impl UnwindSafe for CdpConnection
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