use browsing::browser::{Browser, BrowserProfile};
use std::sync::Arc;
#[tokio::main]
async fn main() -> browsing::Result<()> {
let mut browser = Browser::new(BrowserProfile::default());
browser.start().await?;
let client = Arc::clone(&browser.get_cdp_client()?);
let har = browsing::HarManager::new_with_body(client);
har.start_capture().await?;
browser.navigate("https://httpbin.org/html").await?;
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
let count = har.entry_count().await;
println!("Captured {} entries", count);
let har_log = har.export_har().await;
std::fs::write("capture.har", serde_json::to_string_pretty(&har_log)?)?;
println!("HAR saved: capture.har");
Ok(())
}