Crates.io | cdp-rs |
lib.rs | cdp-rs |
version | 0.3.3 |
source | src |
created_at | 2022-11-07 23:03:45.221041 |
updated_at | 2023-01-08 16:23:29.721317 |
description | Chrome Dev Protocol client written in Rust |
homepage | |
repository | https://github.com/btbaggin/cdp-rs |
max_upload_size | |
id | 707534 |
size | 13,795 |
Allows interacting with a browser using Chrome Dev Protocol. To use this you must launch an instance of Chrome with remote-debugging-port
chrome.exe --remote-debugging-port=9222
use cdp_rs::CdpClient;
// Connect to the first tab of your open Chrome instance
let mut cdp = CdpClient::new().connect_to_tab(0)
// Send a message so we can recieve DOM events
cdp.send("DOM.enable", parms!());
while Ok(m) = cdp.wait_message() {
// Print out all messages recieved
print!("Recieved: {}", m)
}
use cdp_rs::CdpClient;
// Connect to first tab to a chrome instance running on a non-default remote-debugging-port
let mut cdp = CdpClient::custom("localhost", 9000).connect_to_tab(0);
// Send message with parameters and recieve the response
let cookies = cdp.send("Network.getCookies", parms!("urls", vec!["https://www.google.com"]))?;
// Check cookies