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.)
慕标琳琳
相关分类