From c4d799852a6208d21eb65c96c2c60abfaffa92d6 Mon Sep 17 00:00:00 2001 From: Michael Herrmann Date: Thu, 3 Aug 2023 18:26:37 +0200 Subject: [PATCH] Fix caching of chromedriver in start_chrome(...) --- docs/conf.py | 2 +- helium/_impl/chromedriver.py | 8 ++++++++ requirements/base.txt | 2 +- setup.py | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index a4415b6..63963f0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,7 @@ author = 'Michael Herrmann' # Also update ../setup.py when you change this: -release = '3.2.4' +release = '3.2.5' # -- General configuration --------------------------------------------------- diff --git a/helium/_impl/chromedriver.py b/helium/_impl/chromedriver.py index 597cd46..a96c761 100644 --- a/helium/_impl/chromedriver.py +++ b/helium/_impl/chromedriver.py @@ -1,6 +1,14 @@ from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.core.driver_cache import DriverCacheManager +import webdriver_manager + +# Work around a bug in webdriver_manager: +if webdriver_manager.__version__ == '4.0.0': + class DriverCacheManager(DriverCacheManager): + def __get_metadata_key(self, driver): + super().__get_metadata_key(driver) + return self._metadata_key def install_matching_chromedriver(cache_dir=None): manager = ChromeDriverManager(cache_manager=DriverCacheManager(cache_dir)) diff --git a/requirements/base.txt b/requirements/base.txt index b07cb2e..4994449 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -5,4 +5,4 @@ selenium==3.141.0 # Selenium 3 is incompatible with urllib3 >= 2: urllib3<2 -webdriver-manager==4.0.0 \ No newline at end of file +webdriver-manager>=4.0.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 289f777..cdd7407 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name = 'helium', # Also update docs/conf.py when you change this: - version = '3.2.4', + version = '3.2.5', author = 'Michael Herrmann', author_email = 'michael+removethisifyouarehuman@herrmann.io', description = 'Lighter browser automation based on Selenium.', @@ -16,7 +16,7 @@ 'selenium==3.141.0', # Selenium 3 is incompatible with urllib3 >= 2: 'urllib3<2', - 'webdriver-manager==4.0.0' + 'webdriver-manager>=4.0.0' ], package_data = { 'helium._impl': ['webdrivers/**/*']