From bd5480e6347dd0bb57e95579ad23f349c033d3f8 Mon Sep 17 00:00:00 2001 From: Lolmc0587 Date: Sun, 28 May 2023 08:20:21 +0700 Subject: [PATCH] Fix service creation_flag, custom driver path - selenium.webdriver.common.service cant be used in this situation - Added check driver path, if not it will ignore the driver_execute_path --- undetected_chromedriver/__init__.py | 2 +- undetected_chromedriver/patcher.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/undetected_chromedriver/__init__.py b/undetected_chromedriver/__init__.py index cc66e29..4c4e3fd 100644 --- a/undetected_chromedriver/__init__.py +++ b/undetected_chromedriver/__init__.py @@ -440,7 +440,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver): self.browser_pid = browser.pid if service_creationflags: - service = selenium.webdriver.common.service.Service( + service = selenium.webdriver.chrome.service.Service( self.patcher.executable_path, port, service_args, service_log_path ) for attr_name in ("creationflags", "creation_flags"): diff --git a/undetected_chromedriver/patcher.py b/undetected_chromedriver/patcher.py index d083dc3..6961f13 100644 --- a/undetected_chromedriver/patcher.py +++ b/undetected_chromedriver/patcher.py @@ -115,13 +115,14 @@ class Patcher(object): # self.user_multi_procs != -1: # # -1 being a skip value used later in this block # - p = pathlib.Path(self.data_path) - with Lock(): - files = list(p.rglob("*chromedriver*?")) - for file in files: - if self.is_binary_patched(file): - self.executable_path = str(file) - return True + if not self._custom_exe_path: + p = pathlib.Path(self.data_path) + with Lock(): + files = list(p.rglob("*chromedriver*?")) + for file in files: + if self.is_binary_patched(file): + self.executable_path = str(file) + return True if executable_path: self.executable_path = executable_path