use chromedriver_autodownload instead of uc auto download.
parent
bf3223ffef
commit
6958685b1a
|
@ -55,7 +55,7 @@ import argparse
|
||||||
import itertools
|
import itertools
|
||||||
import chromedriver_autoinstaller
|
import chromedriver_autoinstaller
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.07.22)"
|
CONST_APP_VERSION = "MaxBot (2023.07.23)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
@ -562,6 +562,9 @@ def load_chromdriver_uc(config_dict):
|
||||||
|
|
||||||
driver = None
|
driver = None
|
||||||
if os.path.exists(chromedriver_path):
|
if os.path.exists(chromedriver_path):
|
||||||
|
# use chromedriver_autodownload instead of uc auto download.
|
||||||
|
is_cache_exist = clean_uc_exe_cache()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
@ -576,25 +579,19 @@ def load_chromdriver_uc(config_dict):
|
||||||
print(CONST_CHROME_VERSION_NOT_MATCH_EN)
|
print(CONST_CHROME_VERSION_NOT_MATCH_EN)
|
||||||
print(CONST_CHROME_VERSION_NOT_MATCH_TW)
|
print(CONST_CHROME_VERSION_NOT_MATCH_TW)
|
||||||
|
|
||||||
is_cache_exist = clean_uc_exe_cache()
|
# remove exist chromedriver, download again.
|
||||||
if is_cache_exist:
|
try:
|
||||||
try:
|
os.unlink(chromedriver_path)
|
||||||
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
except PermissionError:
|
||||||
except Exception as exc:
|
pass
|
||||||
pass
|
except FileNotFoundError:
|
||||||
else:
|
pass
|
||||||
# remove exist download again.
|
|
||||||
try:
|
chromedriver_autoinstaller.install(path="webdriver", make_version_dir=False)
|
||||||
os.unlink(chromedriver_path)
|
try:
|
||||||
except PermissionError:
|
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
||||||
pass
|
except Exception as exc2:
|
||||||
except FileNotFoundError:
|
pass
|
||||||
pass
|
|
||||||
chromedriver_autoinstaller.install(path="webdriver", make_version_dir=False)
|
|
||||||
try:
|
|
||||||
driver = uc.Chrome(driver_executable_path=chromedriver_path, options=options, headless=config_dict["advanced"]["headless"])
|
|
||||||
except Exception as exc2:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
print("WebDriver not found at path:", chromedriver_path)
|
print("WebDriver not found at path:", chromedriver_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue