fix bugs when using selenium webdriver

master
Max 2023-08-08 11:15:54 +08:00 committed by GitHub
parent c774efb157
commit cd86293885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -441,14 +441,15 @@ def load_chromdriver_normal(config_dict, driver_type):
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)
# remove exist download again. # remove exist chromedriver, download again.
try: try:
print("Deleting exist and download ChromeDriver again.")
os.unlink(chromedriver_path) os.unlink(chromedriver_path)
except PermissionError: except Exception as exc2:
print(exc2)
pass pass
except FileNotFoundError:
pass chromedriver_autoinstaller.install(path=webdriver_path, make_version_dir=False)
chromedriver_autoinstaller.install(path="webdriver", make_version_dir=False)
chrome_service = Service(chromedriver_path) chrome_service = Service(chromedriver_path)
try: try:
driver = webdriver.Chrome(service=chrome_service, options=chrome_options) driver = webdriver.Chrome(service=chrome_service, options=chrome_options)