WebDriverException: Message: unknown error: Chrome failed to start: crashed error using ChromeDriver Chrome through Selenium Python on Amazon Linux

10,787

This error message...

selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (chrome not reachable)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.


As per the discussion in Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed, the expected default location of on is:

/usr/bin/google-chrome

Note: For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary.

So ideally, the following minimal code block should have worked:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.binary_location = '/usr/bin/google-chrome'
driver = webdriver.Chrome(options=options, executable_path='/usr/local/bin/chromedriver')
driver.get('http://www.google.com/')

But it seems, when you try to initiate a Chrome session manually, Segmentation fault occurs i.e. crashes as follows:

[ec2-user@ip-xxx-xx-xx-xxx bin]$ pwd
/usr/bin
[ec2-user@ip-xxx-xx-x-xxx bin]$ google-chrome
Segmentation fault

Segmentation fault

Segmentation fault (shortened as segfault) or access violation is a fault or failure condition raised by hardware with memory protection, notifying an operating system that the software has attempted to access a restricted area of memory. The OS kernel will, in response, usually perform some corrective action, generally passing the fault on to the offending process (your script) by sending the process a signal.

In short, it’s a helper mechanism to restrict programs/scripts from corrupting the memory which does not belong to it. See more here.


Reason and Solutions

The pottential reasons and solutions are:

  • Chrome is not at all installed within the system, so you have to install Chrome
  • Chrome is not installed at the default location, so you have to pass the correct location of chrome executable through binary_location property.
  • The symlink /usr/bin/google-chrome to the actual Chrome binary got corrupted, so you may have to create the symlink.
  • The user doesn't have required access rights /usr/bin/google-chrome, so you have provide the access rights.
Share:
10,787
Brent Heigold
Author by

Brent Heigold

Updated on June 30, 2022

Comments