【发布时间】:2021-04-14 15:42:56
【问题描述】:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = driver_path
options.add_argument("--start-maximized")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(options=options, executable_path=driver_path)
上面的代码不会成功运行chromedriver,它的错误信息是:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: was killed.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location ${driver_path} is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
我看到一些建议将包含驱动程序文件的文件夹设置为路径,但我不想使用该方法,所以我没有尝试过。
我不知道为什么司机被杀。驱动程序是最新的,并且版本与安装的 Chrome 浏览器匹配。计算机有 24GB 的额外 RAM,因此不太可能是 RAM 问题。奇怪的是,该代码在我的笔记本电脑上运行,但在我的台式机上却不行。
【问题讨论】: