本文介紹了Selenium:WebDriverException:Chrome 無法啟動:由于 google-chrome 不再運行而崩潰,因此 ChromeDriver 假設 Chrome 已崩潰的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
最近我換了電腦,從那以后我就不能用 selenium 啟動 chrome.我也嘗試過 Firefox,但瀏覽器實例無法啟動.
Recently I switched computers and since then I can't launch chrome with selenium. I've also tried Firefox but the browser instance just doesn't launch.
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
i have the latest chrome version and chromedriver installed
嘗試@b0sss 解決方案后,我收到以下錯誤.
After trying @b0sss solution i am getting the following error.
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)
推薦答案
嘗試在這里下載并使用這個最新的 chrome 驅動程序版本.
Try to download HERE and use this latest chrome driver version.
https://sites.google.com/a/chromium.org/chromedriver/下載
試試這個:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
d = webdriver.Chrome('/home/PycharmProjects/chromedriver',chrome_options=chrome_options)
d.get('https://www.google.nl/')
這篇關于Selenium:WebDriverException:Chrome 無法啟動:由于 google-chrome 不再運行而崩潰,因此 ChromeDriver 假設 Chrome 已崩潰的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!