为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

牧羊人nacy 2023-09-19 14:59:58
from selenium import webdriverdriver = 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.)
查看完整描述

1 回答

?
慕标琳琳

TA贡献1830条经验 获得超9个赞

由于某种原因,它在 vscode 终端中停止工作。否则它工作得很好。



查看完整回答
反对 回复 2023-09-19
  • 1 回答
  • 0 关注
  • 552 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信