fix: use Chromium for better chromedriver compatibility

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-12-14 17:11:13 -03:00
parent 1ae6c6e5c7
commit cf720936d2

View file

@ -157,13 +157,14 @@ pub fn browser_config() -> BrowserConfig {
let webdriver_url = std::env::var("WEBDRIVER_URL") let webdriver_url = std::env::var("WEBDRIVER_URL")
.unwrap_or_else(|_| format!("http://localhost:{}", CHROMEDRIVER_PORT)); .unwrap_or_else(|_| format!("http://localhost:{}", CHROMEDRIVER_PORT));
// Detect Brave browser path - need actual binary, not wrapper script // Detect browser binary - prioritize Chromium which works best with system chromedriver
let brave_paths = [ // Brave nightly has compatibility issues with chromedriver
"/opt/brave.com/brave-nightly/brave", // Brave Nightly actual binary let browser_paths = [
"/opt/brave.com/brave/brave", // Brave stable actual binary "/usr/bin/chromium-browser", // Chromium - best compatibility
"/snap/brave/current/opt/brave.com/brave/brave", // Snap installation "/snap/bin/chromium", // Snap Chromium
"/usr/bin/google-chrome", // Chrome as fallback "/usr/bin/google-chrome", // Google Chrome
"/usr/bin/chromium-browser", // Chromium as fallback "/usr/bin/google-chrome-stable", // Chrome stable
"/opt/brave.com/brave/brave", // Brave stable (may have issues)
]; ];
let mut config = BrowserConfig::default() let mut config = BrowserConfig::default()
@ -173,8 +174,8 @@ pub fn browser_config() -> BrowserConfig {
.with_timeout(Duration::from_secs(30)) .with_timeout(Duration::from_secs(30))
.with_window_size(1920, 1080); .with_window_size(1920, 1080);
// Add Brave binary path if found // Add browser binary path if found
for path in &brave_paths { for path in &browser_paths {
if std::path::Path::new(path).exists() { if std::path::Path::new(path).exists() {
log::info!("Using browser binary: {}", path); log::info!("Using browser binary: {}", path);
config = config.with_binary(path); config = config.with_binary(path);