use browsing::browser::{Browser, BrowserProfile};
use serde_json::json;
#[tokio::main]
async fn main() -> browsing::Result<()> {
let mut browser = Browser::new(BrowserProfile::default());
browser.start().await?;
browser.navigate("https://example.com").await?;
let result = browser
.raw_cdp_command("Runtime.evaluate", json!({"expression": "document.title"}))
.await?;
let title = result
.get("result")
.and_then(|r| r.get("value"))
.and_then(|v| v.as_str())
.unwrap_or("N/A");
println!("Page title via raw CDP: {}", title);
Ok(())
}