From 843173827aa2e56dcaa713fd2fa769d2f01146e8 Mon Sep 17 00:00:00 2001 From: sebdelsol Date: Fri, 18 Mar 2022 16:11:55 +0100 Subject: [PATCH] fix find_chrome_executable() on x86 Windows --- undetected_chromedriver/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/undetected_chromedriver/__init__.py b/undetected_chromedriver/__init__.py index e8da4e6..57c04bd 100644 --- a/undetected_chromedriver/__init__.py +++ b/undetected_chromedriver/__init__.py @@ -689,12 +689,13 @@ def find_chrome_executable(): for item in map( os.environ.get, ("PROGRAMFILES", "PROGRAMFILES(X86)", "LOCALAPPDATA") ): - for subitem in ( - "Google/Chrome/Application", - "Google/Chrome Beta/Application", - "Google/Chrome Canary/Application", - ): - candidates.add(os.sep.join((item, subitem, "chrome.exe"))) + if item is not None: + for subitem in ( + "Google/Chrome/Application", + "Google/Chrome Beta/Application", + "Google/Chrome Canary/Application", + ): + candidates.add(os.sep.join((item, subitem, "chrome.exe"))) for candidate in candidates: if os.path.exists(candidate) and os.access(candidate, os.X_OK): return os.path.normpath(candidate)