feat: Add MaxRetryError exception handling in LocalSeleniumCrawlerStrategy
This commit is contained in:
@@ -8,6 +8,7 @@ from selenium.webdriver.chrome.options import Options
|
|||||||
from selenium.common.exceptions import InvalidArgumentException, WebDriverException
|
from selenium.common.exceptions import InvalidArgumentException, WebDriverException
|
||||||
from selenium.webdriver.chrome.service import Service as ChromeService
|
from selenium.webdriver.chrome.service import Service as ChromeService
|
||||||
from webdriver_manager.chrome import ChromeDriverManager
|
from webdriver_manager.chrome import ChromeDriverManager
|
||||||
|
from urllib3.exceptions import MaxRetryError
|
||||||
|
|
||||||
from .config import *
|
from .config import *
|
||||||
import logging, time
|
import logging, time
|
||||||
@@ -219,7 +220,7 @@ class LocalSeleniumCrawlerStrategy(CrawlerStrategy):
|
|||||||
can_not_be_done_headless = False # Look at my creativity for naming variables
|
can_not_be_done_headless = False # Look at my creativity for naming variables
|
||||||
|
|
||||||
# TODO: Very ugly way for now but it works
|
# TODO: Very ugly way for now but it works
|
||||||
if kwargs.get('bypass_headless', True) or html == "<html><head></head><body></body></html>":
|
if kwargs.get('bypass_headless', False) or html == "<html><head></head><body></body></html>":
|
||||||
print("[LOG] 🙌 Page could not be loaded in headless mode. Trying non-headless mode...")
|
print("[LOG] 🙌 Page could not be loaded in headless mode. Trying non-headless mode...")
|
||||||
can_not_be_done_headless = True
|
can_not_be_done_headless = True
|
||||||
options = Options()
|
options = Options()
|
||||||
|
|||||||
Reference in New Issue
Block a user