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.
Add Edge browser support using EdgeChromiumDriverManager (#3058)
Abdelkarim Habouchb958386689e6
diff --git a/.env.template b/.env.templateindex a32bf936ee..aba612fd7a 100644--- a/.env.template+++ b/.env.template@@ -192,7 +192,7 @@ OPENAI_API_KEY=your-openai-api-key### BROWSER## HEADLESS_BROWSER - Whether to run the browser in headless mode (default: True)## USE_WEB_BROWSER - Sets the web-browser driver to use with selenium (default: chrome).-## Note: set this to either 'chrome', 'firefox', or 'safari' depending on your current browser+## Note: set this to either 'chrome', 'firefox', 'safari' or 'edge' depending on your current browser# HEADLESS_BROWSER=True# USE_WEB_BROWSER=chrome## BROWSE_CHUNK_MAX_LENGTH - When browsing website, define the length of chunks to summarize (in number of tokens, excluding the response. 75 % of FAST_TOKEN_LIMIT is usually wise )diff --git a/autogpt/commands/web_selenium.py b/autogpt/commands/web_selenium.pyindex 8cec23238d..4f5ad30ea5 100644--- a/autogpt/commands/web_selenium.py+++ b/autogpt/commands/web_selenium.py@@ -10,6 +10,7 @@ from selenium import webdriverfrom selenium.common.exceptions import WebDriverExceptionfrom selenium.webdriver.chrome.options import Options as ChromeOptionsfrom selenium.webdriver.common.by import By+from selenium.webdriver.edge.options import Options as EdgeOptionsfrom selenium.webdriver.firefox.options import Options as FirefoxOptionsfrom selenium.webdriver.remote.webdriver import WebDriverfrom selenium.webdriver.safari.options import Options as SafariOptions@@ -17,6 +18,7 @@ from selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.support.wait import WebDriverWaitfrom webdriver_manager.chrome import ChromeDriverManagerfrom webdriver_manager.firefox import GeckoDriverManager+from webdriver_manager.microsoft import EdgeChromiumDriverManagerimport autogpt.processing.text as summaryfrom autogpt.commands.command import command@@ -78,6 +80,7 @@ def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]:"chrome": ChromeOptions,"safari": SafariOptions,"firefox": FirefoxOptions,+ "edge": EdgeOptions,}options = options_available[CFG.selenium_web_browser]()@@ -96,6 +99,10 @@ def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]:# Requires a bit more setup on the users end# See https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safaridriver = webdriver.Safari(options=options)+ elif CFG.selenium_web_browser == "edge":+ driver = webdriver.Edge(+ executable_path=EdgeChromiumDriverManager().install(), options=options+ )else:if platform == "linux" or platform == "linux2":options.add_argument("--disable-dev-shm-usage")