Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed

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/') 

i get the following error:

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) 

i have the latest chrome version and chromedriver installed

EDIT: 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) 
like image 824
SOeh Avatar asked Oct 30 '18 21:10

SOeh


1 Answers

Try to download HERE and use this latest chrome driver version:

  • https://sites.google.com/chromium.org/driver/

Try this:

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/<user>/chromedriver',chrome_options=chrome_options) d.get('https://www.google.nl/') 
like image 130
NgoCuong Avatar answered Oct 05 '22 16:10

NgoCuong