问题描述
由于这个问题,我被困了好几天,似乎找不到解决方案.无论我做什么,我都无法让 chromedriver 在我的机器上工作.我已经尝试了几乎所有我能想象到的设置.列举几个:
- Chrome 64 位,Python 64 位
- Chrome 32 位,Python 32 位
- Chrome 64 位,Python 32 位
- Chrome 32 位,Python 64 位
我还尝试了不同版本的 Chrome 及其相应的 chromedriver 版本.我已经尝试过不同的 selenium 早期版本,也就是说,在前面提到的每个设置上.
对于实际情况,这是我当前的设置:
- Windows 10 专业版 x64
- Python 3.6.3 64 位
- 硒 3.7.0
- 谷歌浏览器 62.0.3202.75 64 位
- Chromedriver 2.33
我不会发布我的代码,因为无论我使用哪个代码,它都会失败.即使是启动 chromedriver 的最简单最基本的代码也不起作用.此外,它适用于我同事的机器.因此,为了提供一些上下文,这是我尝试过的一个不起作用的代码片段:
从 selenium 导入 webdriverwebdriver.Chrome(executable_path="bin/chromedriver.exe")
我也尝试将 chromedriver 添加到我的 PATH
并启动不带参数的 chromedriver,但这也不起作用.
我得到的错误是这个:
selenium.common.exceptions.WebDriverException:消息:未知错误:chrome 无法启动(驱动程序信息:chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),平台=Windows NT 10.0.15063 x86_64)
如果我使用详细/日志记录参数启动驱动程序,则会生成以下日志:
[1.979][INFO]: COMMAND InitSession {能力":{总是匹配":{浏览器名称":铬",谷歌:chromeOptions":{参数":[],扩展":[]},平台名称":任何"},第一场比赛":[{}]},所需能力":{浏览器名称":铬",谷歌:chromeOptions":{参数":[],扩展":[]},平台":任何",版本": ""}}[1.985][INFO]:填充首选项文件:{alternate_error_pages":{启用":假},自动填充":{启用":假},浏览器":{check_default_browser":假},分配": {import_bookmarks":假,import_history":假,import_search_engine":假,make_chrome_default_for_user":假,show_welcome_page":假,skip_first_run_ui":真},dns_prefetching":{启用":假},轮廓": {内容设置": {模式对":{"https://*,*": {媒体流":{音频":默认",视频":默认"}}}},默认内容设置值":{地理位置":1},默认内容设置":{地理位置":1,鼠标锁":1,通知":1,弹出窗口":1,ppapi经纪人":1},password_manager_enabled":假},安全浏览": {启用":假},搜索": {建议启用":假},翻译": {启用":假}}[1.989][INFO]:填充本地状态文件:{背景模式":{启用":假},ssl":{rev_checking":{启用":假}}}[2.004][INFO]:无法切换到美式键盘布局 - 某些键可能被错误解释[2.004][INFO]:启动 chrome:C:Program Files (x86)GoogleChromeApplicationchrome.exe"--disable-background-networking --disable-browser-side-navigation --disable-客户端网络钓鱼检测 --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension="C:UsersOLIVIE~1.VERAppDataLocalTempscoped_dir9668_31484internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12606 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:UsersOLIVIE~1.VERAppDataLocalTempscoped_dir9668_609" 数据:,[2.035][INFO]:响应 InitSession 未知错误:chrome 无法启动[2.035][DEBUG]:日志类型驱动程序"在销毁时丢失 0 个条目[2.035][DEBUG]:日志类型浏览器"在销毁时丢失 0 个条目
我已经查看了我能找到的几乎所有类似的问题,例如 这个和这个,我遇到的任何解决方案都没有帮助,我得到的总是同样的错误.我尝试过十几种不同的设置时都遇到了同样的错误.
我记得几个月前我在同一台机器上成功地为另一个项目运行了 chromedriver.
我想我已经提供了所有必要的信息,但如果我忘记了什么,请随时在评论中问我.
谢谢
我最终经历了无数种不同的解决方案,但没有任何结果,但最终似乎真正解决了这个问题的是:
- 卸载 Chrome
- 检查 Windows 注册表并删除所有名为
{8A69D345-D564-463C-AFF1-A69D9E530F96}
的键 - 重新安装 Chrome
在遵循 DebanjanB's answer 的解决方案后,我最终得到了这个解决方案,并且无法再安装 Chrome.在搜索这个新问题时,我找到了这篇文章.p>
记得在执行此操作之前备份您的注册表.
完成此操作后,我能够重新安装 Chrome 并运行 chromedriver.
I've been stuck for days because of this issue and can't seem to find a solution. I can't get the chromedriver to work on my machine, no matter what I do. I've tried pretty much every setup I could possibly imagine. To list a few:
- Chrome 64 bits, Python 64 bits
- Chrome 32 bits, Python 32 bits
- Chrome 64 bits, Python 32 bits
- Chrome 32 bits, Python 64 bits
I've also tried different versions of Chrome with their corresponding chromedriver versions. I've tried different prior versions of selenium, and that is, on every previously mentioned setups.
For an actual context, here's my current setup:
- Windows 10 Professional x64
- Python 3.6.3 64 bits
- Selenium 3.7.0
- Google Chrome 62.0.3202.75 64 bits
- Chromedriver 2.33
I will not post my code as no matter which code I use, it fails. Even the simplest most basic code that launches a chromedriver will not work. Also, it works on my colleague's machine. So to give some context, here's a code snippet I've tried that doesn't work:
from selenium import webdriver
webdriver.Chrome(executable_path="bin/chromedriver.exe")
I've also tried to add the chromedriver to my PATH
and launching the chromedriver with no arguments but this doesn't work either.
The error I'm getting is this one:
selenium.common.exceptions.WebDriverException: Message: unknown error: chrome failed to start
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.15063 x86_64)
And here's the log that gets generated if I launch the driver with the verbose/logging parameters:
[1.979][INFO]: COMMAND InitSession {
"capabilities": {
"alwaysMatch": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
},
"platformName": "any"
},
"firstMatch": [ {
} ]
},
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
},
"platform": "ANY",
"version": ""
}
}
[1.985][INFO]: Populating Preferences file: {
"alternate_error_pages": {
"enabled": false
},
"autofill": {
"enabled": false
},
"browser": {
"check_default_browser": false
},
"distribution": {
"import_bookmarks": false,
"import_history": false,
"import_search_engine": false,
"make_chrome_default_for_user": false,
"show_welcome_page": false,
"skip_first_run_ui": true
},
"dns_prefetching": {
"enabled": false
},
"profile": {
"content_settings": {
"pattern_pairs": {
"https://*,*": {
"media-stream": {
"audio": "Default",
"video": "Default"
}
}
}
},
"default_content_setting_values": {
"geolocation": 1
},
"default_content_settings": {
"geolocation": 1,
"mouselock": 1,
"notifications": 1,
"popups": 1,
"ppapi-broker": 1
},
"password_manager_enabled": false
},
"safebrowsing": {
"enabled": false
},
"search": {
"suggest_enabled": false
},
"translate": {
"enabled": false
}
}
[1.989][INFO]: Populating Local State file: {
"background_mode": {
"enabled": false
},
"ssl": {
"rev_checking": {
"enabled": false
}
}
}
[2.004][INFO]: Cannot switch to US keyboard layout - some keys may be interpreted incorrectly
[2.004][INFO]: Launching chrome: "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --disable-background-networking --disable-browser-side-navigation --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension="C:UsersOLIVIE~1.VERAppDataLocalTempscoped_dir9668_31484internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12606 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir="C:UsersOLIVIE~1.VERAppDataLocalTempscoped_dir9668_609" data:,
[2.035][INFO]: RESPONSE InitSession unknown error: chrome failed to start
[2.035][DEBUG]: Log type 'driver' lost 0 entries on destruction
[2.035][DEBUG]: Log type 'browser' lost 0 entries on destruction
I've had a look at pretty much every similar questions I could find, like this one, and this one for example, and none of the solutions I've came across helped, it's always the same error I get. I've been having the same error with the dozen of different setups I've tried.
A few months ago I remember I successfully ran the chromedriver for another project on the same machine.
I think I've provided all the necessary information, but don't hesitate to ask me in comments if I forgot something.
Thanks
I ended up going through an endless amount of different solutions with no results, but what seemed to really fix it in the end was the following:
- Uninstall Chrome
- Go through Windows Registry and delete every keys named
{8A69D345-D564-463C-AFF1-A69D9E530F96}
- Reinstall Chrome
I ended up getting to this solution after following the solution from DebanjanB's answer and couldn't install Chrome anymore. Searching about this new issue led me to find this post.
Remember to backup your registry before doing this.
After doing this I was able to reinstall Chrome and run the chromedriver.
这篇关于未知错误:chrome 无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!