selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome无法以Selenium和RaspberryPi上的Chrome启动

时间:2018-09-23 13:22:25

标签: python selenium raspberry-pi selenium-chromedriver chromium

我创建了一些非常简单的脚本,只是使用特定的URL打开浏览器,如下所示:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("http://www.python.org")

一旦我使用命令python /path/to/file.py执行此操作 我收到一个错误:

Traceback (most recent call last):
  File "/home/pi/tmp/test.py", line 4, in <module>
    driver = webdriver.Chrome()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (chrome not reachable)
  (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.40,platform=Linux 4.14.69-v7+ armv7l)

似乎我的内存或idk用完了。 知道有什么问题吗?

1 个答案:

答案 0 :(得分:0)

此错误消息...

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (chrome not reachable)
  (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.40,platform=Linux 4.14.69-v7+ armv7l)

...表示 ChromeDriver 无法启动/产生新的 WebBrowser ,即 Chrome浏览器会话。

Selenium Client Chrome 的版本信息将有助于我们分析您的问题。但是根据讨论:

您的主要问题似乎是所使用的二进制版本之间的不兼容性

  • 您正在使用 chromedriver = 2.40
  • chromedriver=2.40的发行说明中明确提到以下内容:
  

支持 Chrome v66-68

  • Chrome 的当前发行版本是 v69.0

如果您使用的是 Chrome v69.0 ,则 ChromeDriver v2.40 Chrome浏览器v69.0 之间不匹配>

解决方案