. Advertisement .
. Advertisement .
What is the error “selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed”?
When attempting to utilize Selenium Webdriver, the browser instance doesn’t start and you might 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)
According to the message, the ChromeDriver was unable to start/spawn a new WebBrowser session, or Chrome Browser session. The Chrome browser is not installed in the system’s default location, which is the main problem you have.
ChromeDriver, the server, requires that you have Chrome installed in the system’s default location as shown in the following picture:
......... ADVERTISEMENT .........
The ChromeDriver requests that /usr/bin/google-chrome on Linux platforms will be a symlink to the genuine Chrome binary.
Tips On Solving The Error “selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed”
Option 1: Utilize this approach
To solve “selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed” error, you can do as the following example:
from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.binary_location = "C:\\path\\to\\your\\chrome.exe" #chrome binary location specified here options.add_argument("--start-maximized") #open Browser in maximized mode options.add_argument("--no-sandbox") #bypass OS security model options.add_argument("--disable-dev-shm-usage") #overcome limited resource problems options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) driver = webdriver.Chrome(options=options, executable_path=r'C:\path\to\chromedriver.exe') driver.get('http://google.com/')
Option 2: Download the latest Chrome driver version that corresponds to your browser’s version.
Firstly, check the version of your Chrome browser. Simply download the chrome driver version that corresponds to your Chrome version from this link. Simply copy and paste the code below.
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('your-chrome-driver-path',chrome_options=chrome_options) d.get('https://www.google.nl/')
The error “selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed” is a confusing error message. We hope this blog has helped clear the air around what this error message means and how to solve it. If you have more questions about this issue, please leave a comment below. Thank you for reading; we are always excited when one of our posts can provide useful information on a topic like this!
→ The Effective Solutions For The Error “Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection in Java”
Leave a comment