From 10b757fea7c604ca811c4c230e9e259c8bdfac24 Mon Sep 17 00:00:00 2001 From: Jianzhang Ni <550912245@qq.com> Date: Mon, 17 Apr 2023 11:49:56 +0800 Subject: [PATCH 1/2] Update web_selenium.py By adding these two arguments can fix the chrome crash problem --- autogpt/commands/web_selenium.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autogpt/commands/web_selenium.py b/autogpt/commands/web_selenium.py index 8c652294587f..f8827a5f8818 100644 --- a/autogpt/commands/web_selenium.py +++ b/autogpt/commands/web_selenium.py @@ -76,6 +76,8 @@ def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]: driver = webdriver.Safari(options=options) else: options.add_argument("--no-sandbox") + options.add_argument('--headless') + options.add_argument('--disable-gpu') driver = webdriver.Chrome( executable_path=ChromeDriverManager().install(), options=options ) From f16528b2433f2008b54d2da4cb33e9603816da99 Mon Sep 17 00:00:00 2001 From: Jianzhang Ni Date: Mon, 17 Apr 2023 23:04:25 +0800 Subject: [PATCH 2/2] Update web_selenium.py Check system type before changing chrome into headless mode --- autogpt/commands/web_selenium.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autogpt/commands/web_selenium.py b/autogpt/commands/web_selenium.py index f8827a5f8818..1db97976203e 100644 --- a/autogpt/commands/web_selenium.py +++ b/autogpt/commands/web_selenium.py @@ -15,6 +15,7 @@ from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium.webdriver.safari.options import Options as SafariOptions import logging +import platform from pathlib import Path from autogpt.config import Config @@ -76,8 +77,9 @@ def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]: driver = webdriver.Safari(options=options) else: options.add_argument("--no-sandbox") - options.add_argument('--headless') - options.add_argument('--disable-gpu') + if platform.system() == 'Linux': + options.add_argument('--headless') + options.add_argument('--disable-gpu') driver = webdriver.Chrome( executable_path=ChromeDriverManager().install(), options=options )