Runs automatically when --chrome-headless flag is used, checking: - ChromeDriver installation and PATH - Chrome/Chromium installation - Chrome and ChromeDriver version compatibility - config.toml chrome_binary setting - Chrome for Testing installation - ChromeDriver executable permissions (macOS quarantine) Displays a detailed report with: - Summary of detected versions and paths - Pass/warning/error status for each check - Specific fix suggestions for any issues found Users can then ask g3 to help fix any detected issues.
62 lines
1.9 KiB
Rust
62 lines
1.9 KiB
Rust
// Suppress warnings from objc crate macros
|
|
#![allow(unexpected_cfgs)]
|
|
|
|
pub mod macax;
|
|
pub mod ocr;
|
|
pub mod platform;
|
|
pub mod types;
|
|
pub mod webdriver;
|
|
|
|
// Re-export webdriver types for convenience
|
|
pub use webdriver::{
|
|
chrome::ChromeDriver, safari::SafariDriver, WebDriverController, WebElement,
|
|
diagnostics::{run_diagnostics as run_chrome_diagnostics, ChromeDiagnosticReport, DiagnosticStatus},
|
|
};
|
|
|
|
// Re-export macax types for convenience
|
|
pub use macax::{AXApplication, AXElement, MacAxController};
|
|
|
|
use anyhow::Result;
|
|
use async_trait::async_trait;
|
|
use types::*;
|
|
|
|
#[async_trait]
|
|
pub trait ComputerController: Send + Sync {
|
|
// Screen capture
|
|
async fn take_screenshot(
|
|
&self,
|
|
path: &str,
|
|
region: Option<Rect>,
|
|
window_id: Option<&str>,
|
|
) -> Result<()>;
|
|
|
|
// OCR operations
|
|
async fn extract_text_from_screen(&self, region: Rect, window_id: &str) -> Result<String>;
|
|
async fn extract_text_from_image(&self, path: &str) -> Result<String>;
|
|
async fn extract_text_with_locations(&self, path: &str) -> Result<Vec<TextLocation>>;
|
|
async fn find_text_in_app(
|
|
&self,
|
|
app_name: &str,
|
|
search_text: &str,
|
|
) -> Result<Option<TextLocation>>;
|
|
|
|
// Mouse operations
|
|
fn move_mouse(&self, x: i32, y: i32) -> Result<()>;
|
|
fn click_at(&self, x: i32, y: i32, app_name: Option<&str>) -> Result<()>;
|
|
}
|
|
|
|
// Platform-specific constructor
|
|
pub fn create_controller() -> Result<Box<dyn ComputerController>> {
|
|
#[cfg(target_os = "macos")]
|
|
return Ok(Box::new(platform::macos::MacOSController::new()?));
|
|
|
|
#[cfg(target_os = "linux")]
|
|
return Ok(Box::new(platform::linux::LinuxController::new()?));
|
|
|
|
#[cfg(target_os = "windows")]
|
|
return Ok(Box::new(platform::windows::WindowsController::new()?));
|
|
|
|
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
|
|
anyhow::bail!("Unsupported platform")
|
|
}
|