Selenium:Chrome 无法启动:异常退出。DevToolsActivePort 文件不存在

from selenium import webdriver


driver = webdriver.Chrome()

突然之间,每当webdriver.Chrome()被调用时我都会收到此错误。我尝试按照其他答案的建议使用选项,但这似乎也不起作用,以及指定 Chrome 和 chromedriver 可执行路径。我已将 Chrome (85.0.4183.121) 和 chromedriver (85.0.4183.87) 更新到最新版本,并尝试了其他版本。我使用的是 Ubuntu 20.04。任何帮助深表感谢。


  File "/home/fulco/projects/selenium/test.py", line 3, in <module>

    driver = webdriver.Chrome()

  File "/home/fulco/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__

    RemoteWebDriver.__init__(

  File "/home/fulco/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__

    self.start_session(capabilities, browser_profile)

  File "/home/fulco/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session

    response = self.execute(Command.NEW_SESSION, parameters)

  File "/home/fulco/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute

    self.error_handler.check_response(response)

  File "/home/fulco/.local/lib/python3.8/site-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.

  (unknown error: DevToolsActivePort file doesn't exist)

  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)


牧羊人nacy
浏览 556回答 1
1回答

慕标琳琳

由于某种原因,它在 vscode 终端中停止工作。否则它工作得很好。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python