AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(agent/browser): Print descriptive error if ChromeDriver install fails
Reinier van der Leer7dd97f2f743c
diff --git a/autogpts/autogpt/autogpt/commands/web_selenium.py b/autogpts/autogpt/autogpt/commands/web_selenium.pyindex fa5de1f173..59adb61b4a 100644--- a/autogpts/autogpt/autogpt/commands/web_selenium.py+++ b/autogpts/autogpt/autogpt/commands/web_selenium.py@@ -264,14 +264,21 @@ async def open_page_in_browser(url: str, config: Config) -> WebDriver:_sideload_chrome_extensions(options, config.app_data_dir / "assets" / "crx")- chromium_driver_path = Path("/usr/bin/chromedriver")+ if (chromium_driver_path := Path("/usr/bin/chromedriver")).exists():+ chrome_service = ChromeDriverService(str(chromium_driver_path))+ else:+ try:+ chrome_driver = ChromeDriverManager().install()+ except AttributeError as e:+ if "'NoneType' object has no attribute 'split'" in str(e):+ # https://github.com/SergeyPirogov/webdriver_manager/issues/649+ logger.critical(+ "Connecting to browser failed: is Chrome or Chromium installed?"+ )+ raise+ chrome_service = ChromeDriverService(chrome_driver)+ driver = ChromeDriver(service=chrome_service, options=options)- driver = ChromeDriver(- service=ChromeDriverService(str(chromium_driver_path))- if chromium_driver_path.exists()- else ChromeDriverService(ChromeDriverManager().install()),- options=options,- )driver.get(url)# Wait for page to be ready, sleep 2 seconds, wait again until page ready.