From 0d0408a97742bf28d71f273ec713cc1f075558ff Mon Sep 17 00:00:00 2001 From: g1879 Date: Wed, 12 Jan 2022 14:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/drission.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/DrissionPage/drission.py b/DrissionPage/drission.py index acd3416..304935d 100644 --- a/DrissionPage/drission.py +++ b/DrissionPage/drission.py @@ -485,19 +485,16 @@ def _create_driver(chrome_path: str, driver_path: str, options: Options) -> WebD from DrissionPage.easy_set import _get_chrome_path if chrome_path == 'chrome.exe': - chrome_path = _get_chrome_path(show_msg=False, from_ini=False, from_system_path=False) - if not chrome_path: - chrome_path = _get_chrome_path(show_msg=False, from_ini=False, from_regedit=False) + chrome_path = _get_chrome_path(show_msg=False, from_ini=False) if chrome_path: driver_path = get_match_driver(chrome_path=chrome_path, check_version=False, show_msg=True) - - if driver_path: - try: - options.binary_location = chrome_path - return webdriver.Chrome(driver_path, options=options) - except Exception: - pass + if driver_path: + try: + options.binary_location = chrome_path + return webdriver.Chrome(driver_path, options=options) + except Exception: + pass print('无法启动,请检查浏览器路径,或手动设置chromedriver。\n下载地址:http://npm.taobao.org/mirrors/chromedriver/') exit(0)