几天前不小心删了chrome浏览器,重装后出现问题,今天运行python代码时出现init() got an unexpected keyword argument 'executable_path’
错误,以前没有出现过的,于是我执行
pip show selenium
pip install selenium==4.9.0
后,出现更严重的问题
Traceback (most recent call last):
File "D:\aaa\py3\DayUpdateDatafun.py", line 131, in <module>
DayUpdateDatafun()
File "D:\aaa\py3\DayUpdateDatafun.py", line 80, in DayUpdateDatafun
findx.up_ths_gn_kl_all()
File "D:\aaa\py3\findx.py", line 33077, in up_ths_gn_kl_all
up_ths_gn_kl(code,name)
File "D:\aaa\py3\findx.py", line 33060, in up_ths_gn_kl
df=get_ths_kl_rt_cs(code,name,1)
File "D:\aaa\py3\findx.py", line 33038, in get_ths_kl_rt_cs
return get_ths_gn_kl(platecode)
File "D:\aaa\py3\findx.py", line 32949, in get_ths_gn_kl
html = get_page_detail(url)
File "D:\aaa\py3\findx.py", line 32935, in get_page_detail
'Cookie': 'v={}'.format(get_cookie())
File "D:\aaa\py3\findx.py", line 32916, in get_cookie
driver = webdriver.Chrome(executable_path=CHROME_DRIVER_PATH,chrome_options=
options)#
File "d:\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", l
ine 93, in __init__
keep_alive,
File "d:\Python37\lib\site-packages\selenium\webdriver\chromium\webdriver.py",
line 112, in __init__
options=options,
File "d:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 286, in __init__
self.start_session(capabilities, browser_profile)
File "d:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 378, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "d:\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 440, in execute
self.error_handler.check_response(response)
File "d:\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py"
, line 245, in check_response
raise exception_class(message, screen, stacktrace)selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process.
Stacktrace:
Backtrace:
(No symbol) [0x00496643]
(No symbol) [0x0042BE21]
(No symbol) [0x0032DA9D]
(No symbol) [0x0034D95D]
(No symbol) [0x0034A899]
(No symbol) [0x00386917]
(No symbol) [0x0038655C]
(No symbol) [0x0037FB76]
(No symbol) [0x003549C1]
(No symbol) [0x00355E5D]
GetHandleVerifier [0x0070A142+2497106]
GetHandleVerifier [0x007385D3+2686691]
GetHandleVerifier [0x0073BB9C+2700460]
GetHandleVerifier [0x00543B10+635936]
(No symbol) [0x00434A1F]
(No symbol) [0x0043A418]
(No symbol) [0x0043A505]
(No symbol) [0x0044508B]
BaseThreadInitThunk [0x76B6343D+18]
RtlInitializeExceptionChain [0x779E9802+99]
RtlInitializeExceptionChain [0x779E97D5+54]
这个问题困扰我几天了,昨天重装浏览器后好了一阵,跑我的python代码没问题,今天又出现了前面提到的问题
建议开发环境尽量独立,指定驱动的时候不使用本地日常使用浏览器驱动,而是直接指定单独下载的驱动。
https://googlechromelabs.github.io/chrome-for-testing/