From b50c6cbd6fda90407f10a1308834008a4cc524c4 Mon Sep 17 00:00:00 2001 From: Faizan Alhassan Date: Sun, 29 Oct 2023 14:02:03 +0500 Subject: [PATCH] chromedriver custom path issue fixed --- undetected_chromedriver/patcher.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/undetected_chromedriver/patcher.py b/undetected_chromedriver/patcher.py index 1b5409d..7bc028c 100644 --- a/undetected_chromedriver/patcher.py +++ b/undetected_chromedriver/patcher.py @@ -129,17 +129,6 @@ class Patcher(object): Returns: """ - p = pathlib.Path(self.data_path) - if self.user_multi_procs: - with Lock(): - files = list(p.rglob("*chromedriver*")) - most_recent = max(files, key=lambda f: f.stat().st_mtime) - files.remove(most_recent) - list(map(lambda f: f.unlink(), files)) - if self.is_binary_patched(most_recent): - self.executable_path = str(most_recent) - return True - if executable_path: self.executable_path = executable_path self._custom_exe_path = True @@ -150,6 +139,17 @@ class Patcher(object): return self.patch_exe() else: return + + p = pathlib.Path(self.data_path) + if self.user_multi_procs: + with Lock(): + files = list(p.rglob("*chromedriver*")) + most_recent = max(files, key=lambda f: f.stat().st_mtime) + files.remove(most_recent) + list(map(lambda f: f.unlink(), files)) + if self.is_binary_patched(most_recent): + self.executable_path = str(most_recent) + return True if version_main: self.version_main = version_main