diff --git a/openhands-tools/openhands/tools/browser_use/impl.py b/openhands-tools/openhands/tools/browser_use/impl.py index 19bdce7dc8..5969d8a8c1 100644 --- a/openhands-tools/openhands/tools/browser_use/impl.py +++ b/openhands-tools/openhands/tools/browser_use/impl.py @@ -35,11 +35,45 @@ def _check_chromium_available() -> str | None: if path := shutil.which(binary): return path + # Check common Windows installation paths + windows_chrome_paths = [ + Path(os.environ.get("PROGRAMFILES", "C:\\Program Files")) + / "Google" + / "Chrome" + / "Application" + / "chrome.exe", + Path(os.environ.get("PROGRAMFILES(X86)", "C:\\Program Files (x86)")) + / "Google" + / "Chrome" + / "Application" + / "chrome.exe", + Path(os.environ.get("LOCALAPPDATA", "")) + / "Google" + / "Chrome" + / "Application" + / "chrome.exe", + Path(os.environ.get("PROGRAMFILES", "C:\\Program Files")) + / "Microsoft" + / "Edge" + / "Application" + / "msedge.exe", + Path(os.environ.get("PROGRAMFILES(X86)", "C:\\Program Files (x86)")) + / "Microsoft" + / "Edge" + / "Application" + / "msedge.exe", + ] + for chrome_path in windows_chrome_paths: + if chrome_path.exists(): + return str(chrome_path) + # Check Playwright-installed Chromium playwright_cache_candidates = [ - Path.home() / ".cache" / "ms-playwright", - Path.home() / "Library" / "Caches" / "ms-playwright", + Path.home() / ".cache" / "ms-playwright", # Linux + Path.home() / "Library" / "Caches" / "ms-playwright", # macOS + Path(os.environ.get("LOCALAPPDATA", "")) / "ms-playwright", # Windows ] + for playwright_cache in playwright_cache_candidates: if playwright_cache.exists(): chromium_dirs = list(playwright_cache.glob("chromium-*"))