From 236bdb403556bd6da28740d68392cf0ae067f75f Mon Sep 17 00:00:00 2001 From: unclecode Date: Sat, 6 Jul 2024 14:08:30 +0800 Subject: [PATCH] feat: Add MaxRetryError exception handling in LocalSeleniumCrawlerStrategy --- crawl4ai/crawler_strategy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crawl4ai/crawler_strategy.py b/crawl4ai/crawler_strategy.py index ae8d93df..65afbe4f 100644 --- a/crawl4ai/crawler_strategy.py +++ b/crawl4ai/crawler_strategy.py @@ -8,6 +8,7 @@ from selenium.webdriver.chrome.options import Options from selenium.common.exceptions import InvalidArgumentException, WebDriverException from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager +from urllib3.exceptions import MaxRetryError from .config import * import logging, time @@ -219,7 +220,7 @@ class LocalSeleniumCrawlerStrategy(CrawlerStrategy): can_not_be_done_headless = False # Look at my creativity for naming variables # TODO: Very ugly way for now but it works - if kwargs.get('bypass_headless', True) or html == "": + if kwargs.get('bypass_headless', False) or html == "": print("[LOG] 🙌 Page could not be loaded in headless mode. Trying non-headless mode...") can_not_be_done_headless = True options = Options()