Selenium:WebDriverException:Chrome无法启动:由于google-chrome不再运行而崩溃,因此ChromeDriver认为Chrome已崩溃 - python

最近,我更换了计算机,从那时起,我无法使用硒启动铬。我也尝试过Firefox,但浏览器实例无法启动。

from selenium import webdriver

d = webdriver.Chrome('/home/PycharmProjects/chromedriver')

d.get('https://www.google.nl/')

我收到以下错误:

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.43.600233, platform=Linux 4.15.0-38-generic x86_64)

我安装了最新的Chrome版本和chromedriver

编辑:
尝试@ b0sss解决方案后,出现以下错误。

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (chrome not reachable)
  (The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so chromedriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.15.0-38-generic x86_64)

参考方案

尝试在此处下载并使用此最新的chrome驱动程序版本。

https://sites.google.com/a/chromium.org/chromedriver/downloads

编辑:

试试这个:

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

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
d = webdriver.Chrome('/home/PycharmProjects/chromedriver',chrome_options=chrome_options)
d.get('https://www.google.nl/')

Selenium Chromedriver Python-使用Tor代理加载ModHeader扩展时,“无法等待扩展背景页面加载” - python

该错误是在以前运行正常的程序中无处发生的。绝对可以肯定的是,由于它的功能完善,因此我没有对程序进行任何更改,因此这是迄今为止我所遇到的最奇怪,最令人沮丧的错误。这是我要执行的代码:chrome_options.add_extension('C:\\chromedriver\\ModHeader_v (1).crx') chrome_opt…

Selenium with Python:从具有只读功能的表单中收集电子邮件 - python

我正在尝试从内部具有只读内容的网站上的表单收集电子邮件地址。<input name="email" id="email" type="text" class="form-control" value="[email protected]" readonl…

如何使用Selenium和Python启动基于Chromium的Vivaldi浏览器会话 - python

我正在尝试将vivaldi browser与Selenium一起使用。这是一款与Chrome浏览器非常相似的Chrome浏览器。我有Selenium与Firefox(geckodriver)和Google Chrome(chromedriver)一起工作,但是我似乎找不到Vivaldi的方法。任何帮助,将不胜感激。 python大神给出的解决方案 如果默认情…

如何禁用python和selenium中的Chrome通知弹出窗口? - python

如何禁用python和selenium中的Chrome通知弹出窗口?我试过了:chrome_options = webdriver.ChromeOptions() prefs = {"profile.default_content_setting_values.notifications" : 2} chrome_options.add_…

硒独立服务器日志级别 - python

长话短说:我正在尝试将日志级别更改为Selenium独立服务器上的WARNING。我在CentOS 6.7上运行2.48.2。我在服务器端尝试过,即在启动服务器时添加了-Dselenium.LOGGER.level=WARNING-不起作用。然后,我尝试使用默认级别作为警告的自定义属性文件-Djava.util.logging.config.file=/op…