diff --git a/requirements.txt b/requirements.txt index af8845a..212df01 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ bottle==0.12.25 waitress==2.1.2 -selenium==4.11.2 +selenium==4.15.2 func-timeout==4.3.5 prometheus-client==0.17.1 # required by undetected_chromedriver diff --git a/src/undetected_chromedriver/__init__.py b/src/undetected_chromedriver/__init__.py index af92b73..9bd9823 100644 --- a/src/undetected_chromedriver/__init__.py +++ b/src/undetected_chromedriver/__init__.py @@ -17,7 +17,7 @@ by UltrafunkAmsterdam (https://github.com/ultrafunkamsterdam) from __future__ import annotations -__version__ = "3.5.3" +__version__ = "3.5.4" import json import logging @@ -396,7 +396,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver): if no_sandbox: options.arguments.extend(["--no-sandbox", "--test-type"]) - if headless or options.headless: + if headless or getattr(options, 'headless', None): #workaround until a better checking is found try: v_main = int(self.patcher.version_main) if self.patcher.version_main else 108 @@ -491,7 +491,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver): else: self._web_element_cls = WebElement - if options.headless: + if headless or getattr(options, 'headless', None): self._configure_headless() def _configure_headless(self): diff --git a/src/utils.py b/src/utils.py index dc71e3b..3672511 100644 --- a/src/utils.py +++ b/src/utils.py @@ -153,7 +153,7 @@ def get_webdriver(proxy: dict = None) -> WebDriver: logging.debug("Using webdriver proxy: %s", proxy_url) options.add_argument('--proxy-server=%s' % proxy_url) - # note: headless mode is detected (options.headless = True) + # note: headless mode is detected (headless = True) # we launch the browser in head-full mode with the window hidden windows_headless = False if get_config_headless(): @@ -161,6 +161,8 @@ def get_webdriver(proxy: dict = None) -> WebDriver: windows_headless = True else: start_xvfb_display() + # For normal headless mode: + # options.add_argument('--headless') # if we are inside the Docker container, we avoid downloading the driver driver_exe_path = None