最近我换了电脑,自那以后就无法使用selenium启动Chrome。我还尝试了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)