capture_perfect_screenshots/
capture_perfect_screenshots.rs1use anyhow::Result;
2use headless_engine::browser::tab::BrowserTab;
3use headless_engine::network::fingerprint::DeviceProfile;
4use std::fs;
5use std::path::Path;
6
7#[tokio::main]
8async fn main() -> Result<()> {
9 println!("================================================================================");
10 println!(">>> CAPTURING HIGH-FIDELITY SCREENSHOTS FOR CHATGPT & GOOGLE");
11 println!("================================================================================\n");
12
13 let artifact_dir = Path::new(
14 r"C:\Users\abhis\.gemini\antigravity-ide\brain\c08da294-7846-44b1-9403-559e0d23ce0f",
15 );
16 let evidence_dir = Path::new("evidence");
17
18 println!("[1/3] Capturing ChatGPT (chatgpt.com)...");
20 let mut tab1 = BrowserTab::with_profile(DeviceProfile::ChromeWindows)?;
21 tab1.navigate("https://chatgpt.com/").await?;
22 tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
23 if let Some(shot) = tab1.screenshot_async().await {
24 println!(" -> ChatGPT Screenshot Bytes: {}", shot.png_bytes.len());
25 if !shot.png_bytes.is_empty() {
26 fs::write(evidence_dir.join("chatgpt_screenshot.png"), &shot.png_bytes)?;
27 fs::write(artifact_dir.join("chatgpt_screenshot.png"), &shot.png_bytes)?;
28 }
29 }
30
31 println!("\n[2/3] Capturing Google AI Mode (udm=50)...");
33 let mut tab2 = BrowserTab::with_profile(DeviceProfile::ChromeWindows)?;
34 tab2.navigate("https://www.google.com/search?q=Rust+programming+language+features&udm=50")
35 .await?;
36 tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
37 if let Some(shot) = tab2.screenshot_async().await {
38 println!(
39 " -> Google AI Mode Screenshot Bytes: {}",
40 shot.png_bytes.len()
41 );
42 if !shot.png_bytes.is_empty() {
43 fs::write(
44 evidence_dir.join("google_aimode_screenshot.png"),
45 &shot.png_bytes,
46 )?;
47 fs::write(
48 artifact_dir.join("google_aimode_screenshot.png"),
49 &shot.png_bytes,
50 )?;
51 }
52 }
53
54 println!("\n[3/3] Capturing Google Normal Search...");
56 let mut tab3 = BrowserTab::with_profile(DeviceProfile::ChromeWindows)?;
57 tab3.navigate("https://www.google.com/search?q=headless+browser+pure+rust+engine")
58 .await?;
59 tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
60 if let Some(shot) = tab3.screenshot_async().await {
61 println!(
62 " -> Google Normal Search Screenshot Bytes: {}",
63 shot.png_bytes.len()
64 );
65 if !shot.png_bytes.is_empty() {
66 fs::write(
67 evidence_dir.join("google_normal_search_screenshot.png"),
68 &shot.png_bytes,
69 )?;
70 fs::write(
71 artifact_dir.join("google_normal_search_screenshot.png"),
72 &shot.png_bytes,
73 )?;
74 }
75 }
76
77 println!("\n>>> Finished capturing screenshots.");
78 Ok(())
79}