【发布时间】:2019-04-06 02:21:39
【问题描述】:
在 python 3 中使用 selenium 启动 chromedriver 时, 加载时一切似乎都正常至少一秒钟, 但随后弹出此错误消息:
Traceback (most recent call last):
File "C:\...\Selenium\UsingChrome.py3", line 15, in <module>
driver = webdriver.Chrome(executable_path="chromedriverwin32.exe")
File "c:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "c:\Users\...AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start
self.assert_process_still_running()
File "c:\Users\...\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service chromedriverwin32.exe unexpectedly exited. Status code was: 3221225477
我当前的代码是:
from selenium import webdriver
import time, os
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
options.binary_location = 'chromedriver.exe'
driver = webdriver.Chrome(chrome_options=options)
driver.get('https://python.org')
...我尝试使用绝对路径作为 chromedriver 位置,但这仍然没有帮助(chromedriver.exe 文件与脚本位于同一目录中)
我在 Windows 10 笔记本电脑上的 python 3.6.5 上运行它
我已经在网上搜索了大约 3 个小时,但没有遇到与我得到的相同的错误状态代码。
【问题讨论】:
标签: python python-3.x selenium selenium-chromedriver