当前位置: 首页 > 知识库问答 >
问题:

WebDriverException:消息:未知错误:Chrome无法启动:崩溃

钱嘉致
2023-03-14

我试图将无头chromeselenium一起使用,我为chromedriver到/usr/local/bin的路径创建了一个符号链接,但当我运行

from selenium import webdriver

options = webdriver.ChromeOptions()    
options.add_argument('--headless')

browser = webdriver.Chrome()
browser.get('http://www.google.com')

我的错误是

     Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda2/envs/tensorflow/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/opt/anaconda2/envs/tensorflow/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/opt/anaconda2/envs/tensorflow/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/opt/anaconda2/envs/tensorflow/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/opt/anaconda2/envs/tensorflow/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-327.22.2.el7.x86_64 x86_64)

它还会生成一个核心。******,一个包含五个随机数的核心文件点,大小超过200MB。

版本:

Selenium 3.0.0b3 
Google Chrome 60.0.3112.113  
chromedriver 2.30

有谁能帮我找出问题出在哪里吗?

共有3个答案

许博易
2023-03-14
匿名用户

它在debian系统中为我工作。添加以下内容。

chrome_options.add_argument沙盒

并且我在debian中安装了apt-get Insting-y chroum。

师增
2023-03-14

我在让无头Chrome在Ubuntu14.04上运行时遇到了一个问题,它会因为同样的未知错误而死亡:Chrome无法启动:崩溃错误,我追溯到Selenium驱动程序没有注意到的依赖性问题。

为了诊断,我试着直接运行headless Chrome并得到:

$ google-chrome --headless "http://example.com"
NSS_VersionCheck("3.26") failed. NSS >= 3.26 is required.

这是libnss3安装的:

$ dpkg -s libnss3
Package: libnss3
Version: 2:3.23-0ubuntu0.14.04.1

所以我切换到libnss3-dev

$ apt-get install libnss3-dev
$ dpkg -s libnss3
Package: libnss3
Version: 2:3.28.4-0ubuntu0.14.04.3

并在命令行上重试:

$ google-chrome --headless "http://example.com"
$ echo $?
0

果然,一旦无头Chrome在命令行上运行,它也开始在Selenium中运行。

这些是我目前使用的版本:

$ google-chrome --version
Google Chrome 62.0.3202.94
$ chromedriver --version
ChromeDriver 2.33.506092
$ $ pip freeze |grep selenium
selenium==3.7.0

殳毅
2023-03-14

我在centos7上也遇到了同样的问题。1因为我是root用户,在添加了codechrome\u选项后,问题得到了解决。添加参数('--no sandbox')

这是我的密码

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://www.google.com/')
print driver.current_url
driver.quit()
 类似资料:
  • 问题内容: 我正在尝试使用ChromeWebDriver在Chrome上测试我的应用程序,但是每次尝试都会出现以下异常: 在chromedriver.log中,我看到了 我正在使用: 镀铬36 ChromeWebDriver 2.10 Windows 7的 在Process Explorer中,我可以看到chromedriver.exe进程正在运行,但是没有打开任何窗口,几秒钟后,我得到了上面的异

  • 我在centos上运行无头chrome,无头chrome版本2.38和google-chrome-稳定版本67.0 chrome选项: 最后一行给出以下给定错误消息: 我已经验证了chrome和chromedriver版本,它是兼容的。无法理解为什么它没有在centos上运行?同样的代码在mac上运行良好 聚甲醛

  • 安装Katalon Studio v.5后。8.2对于同事的笔记本电脑,当尝试运行测试时,测试失败,出现此异常 测试失败,因为(的)(堆栈跟踪:com.kms.katalon.core.exception.StepFailedException:无法打开url为“”的浏览器(根本原因:org.openqa.selenium.WebDriverException:未知错误:chrome无法启动(驱动

  • 当我使用机器人框架运行一个chrome浏览器开放测试用例时,我观察到以下错误。 WebDriverException:消息:未知错误:Chrome启动失败:异常退出 (未知错误:DevToolsActivePort文件不存在) (从chrome location/usr/bin/google-Chrome启动的进程不再运行,因此ChromeDriver假设chrome已经崩溃。)(驱动程序信息:C

  • 我有这个代码和一个执行中的问题(代码下的描述) 我使用: Ubuntu 14.04.5 LTS 当我创建RemoteWebDriver时,我得到以下错误:异常:未知错误:Chrome无法启动:崩溃 启动selenium服务器的命令 此方案的哪些部分可能是所述错误的原因?

  • 问题内容: 由于这个问题,我已经呆了好几天,而且似乎找不到解决方案。无论我做什么,我都无法让chromedriver在我的机器上工作。我已经尝试了几乎所有我可以想象的设置。列举一些: Chrome 64位,Python 64位 Chrome 32位,Python 32位 Chrome 64位,Python 32位 Chrome 32位,Python 64位 我还尝试了不同版本的Chrome及其相应