From 9ba4b3bbb0c42e530d54a1b565172f867b1b5626 Mon Sep 17 00:00:00 2001 From: alejanpa17 Date: Mon, 9 Oct 2023 13:28:09 +0200 Subject: [PATCH] fix chrome driver installer problem fix when users of windows have the chrome installation in Program Files (x86) --- .gitignore | 3 +++ modules/chrome_driver_installer.py | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..47985022e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.exe +*.pyc +*.txt \ No newline at end of file diff --git a/modules/chrome_driver_installer.py b/modules/chrome_driver_installer.py index 07e439bb91..139ae8f0f6 100644 --- a/modules/chrome_driver_installer.py +++ b/modules/chrome_driver_installer.py @@ -48,10 +48,11 @@ def get_chrome_version(): process = Popen(["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"], stdout=PIPE) chrome_version = process.communicate()[0].decode("UTF-8").replace("Google Chrome", "").strip() elif platform == "win": - chrome_version = match(r"\d{2,3}.0.\d{4}.\d{1,3}", ' '.join(listdir("C:/Program Files/Google/Chrome/Application"))) - if chrome_version is not None: - chrome_version = chrome_version.group() - else: + try: + chrome_version = match(r"\d{2,3}.0.\d{4}.\d{1,3}", ' '.join(listdir("C:/Program Files/Google/Chrome/Application"))) + if chrome_version is not None: + chrome_version = chrome_version.group() + except: chrome_version = match(r"\d{2,3}.0.\d{4}.\d{1,3}", ' '.join(listdir("C:/Program Files (x86)/Google/Chrome/Application"))) if chrome_version is not None: chrome_version = chrome_version.group()