From faa6512b1f127218f06a028a16fdf153f571ae6b Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Tue, 16 Dec 2025 12:36:18 +1100 Subject: [PATCH] Revert to Safari as default WebDriver browser Chrome headless has too many issues: - Session creation hangs when Chrome is already running - Cloudflare and other bot protection blocks headless browsers - Version mismatch issues between Chrome and ChromeDriver Safari is more reliable for web automation on macOS. Chrome headless is still available via --chrome-headless flag. --- README.md | 8 ++++---- config.example.toml | 4 ++-- crates/g3-cli/src/lib.rs | 4 ++-- crates/g3-config/src/lib.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5dd16cc..ffdcde3 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ See `config.example.toml` for a complete configuration example. ## WebDriver Browser Automation -G3 includes WebDriver support for browser automation tasks. Chrome headless is the default (no visible browser window), with Safari available as an alternative. +G3 includes WebDriver support for browser automation tasks. Safari is the default, with Chrome headless available as an alternative. **One-Time Setup** (macOS only): @@ -266,11 +266,11 @@ safaridriver --enable # Requires password **Usage**: ```bash -# Use Chrome in headless mode (default, no visible window, runs in background) +# Use Safari (default, opens a visible browser window) g3 --webdriver -# Use Safari (opens a visible browser window) -g3 --webdriver --safari +# Use Chrome in headless mode (no visible window, runs in background) +g3 --chrome-headless ``` **Chrome Setup Options**: diff --git a/config.example.toml b/config.example.toml index e2f70c0..8c47b5c 100644 --- a/config.example.toml +++ b/config.example.toml @@ -106,10 +106,10 @@ max_actions_per_second = 5 enabled = false safari_port = 4444 chrome_port = 9515 -# Browser to use: "safari" or "chrome-headless" (default) +# Browser to use: "safari" (default) or "chrome-headless" # Safari opens a visible browser window # Chrome headless runs in the background without a visible window -browser = "chrome-headless" +browser = "safari" # Optional: Path to Chrome binary (e.g., Chrome for Testing) # If not set, ChromeDriver will use the default Chrome installation # Use this to avoid version mismatch issues between Chrome and ChromeDriver diff --git a/crates/g3-cli/src/lib.rs b/crates/g3-cli/src/lib.rs index 0613dfd..6bcff99 100644 --- a/crates/g3-cli/src/lib.rs +++ b/crates/g3-cli/src/lib.rs @@ -343,11 +343,11 @@ pub struct Cli { #[arg(long)] pub webdriver: bool, - /// Use Chrome in headless mode for WebDriver (this is the default) + /// Use Chrome in headless mode for WebDriver (instead of Safari) #[arg(long)] pub chrome_headless: bool, - /// Use Safari for WebDriver (instead of headless Chrome) + /// Use Safari for WebDriver (this is the default) #[arg(long)] pub safari: bool, diff --git a/crates/g3-config/src/lib.rs b/crates/g3-config/src/lib.rs index 004f3af..a3f5910 100644 --- a/crates/g3-config/src/lib.rs +++ b/crates/g3-config/src/lib.rs @@ -119,9 +119,9 @@ pub struct ComputerControlConfig { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] #[serde(rename_all = "lowercase")] pub enum WebDriverBrowser { + #[default] Safari, #[serde(rename = "chrome-headless")] - #[default] ChromeHeadless, } @@ -157,7 +157,7 @@ impl Default for WebDriverConfig { safari_port: 4444, chrome_port: 9515, chrome_binary: None, - browser: WebDriverBrowser::ChromeHeadless, + browser: WebDriverBrowser::Safari, } } }