test_search_modes/
test_search_modes.rs1use anyhow::Result;
2use headless_engine::browser::tab::BrowserTab;
3use headless_engine::network::fingerprint::DeviceProfile;
4
5#[tokio::main]
6async fn main() -> Result<()> {
7 let mut tab = BrowserTab::with_profile(DeviceProfile::ChromeWindows)?;
8
9 let urls = [
10 "https://www.google.com/search?q=headless+browser+rust+engine+for+ai+agents&gbv=1",
11 "https://www.google.com/search?q=headless+browser+rust+engine+for+ai+agents&udm=14",
12 "https://www.google.com/search?q=Rust+programming+language&udm=14",
13 "https://html.duckduckgo.com/html/?q=headless+browser+rust+engine+for+ai+agents",
14 ];
15
16 for url in urls {
17 println!("\n========================================");
18 println!("Testing URL: {}", url);
19 let nav = tab.navigate(url).await?;
20 println!("Status: {}", nav.status);
21 println!("Title: {}", nav.page_title);
22 println!("Bytes: {}", nav.html_bytes);
23 let md = tab.extract_markdown(None).unwrap_or_default();
24 println!("MD Len: {} bytes", md.len());
25 println!("Preview:\n{}", md.chars().take(300).collect::<String>());
26 }
27
28 Ok(())
29}