11
votes

I'm trying to run selenium on Ubuntu 16.10 Server, but I'm getting WebDriverException : Message : chrome not reachable (Driver info: chromedriver 2.9.248304, platform=Linux 4.8.0-22-generic x86_64)

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(800, 600))
display.start()

browser = webdriver.Chrome('usr/bin/chromedriver')
browser.get('http://www.google.com')
print(browser.title)
browser.quit()

display.stop()

Chrome is installed:

google-chrome --version

Google Chrome 57.0.2987.110

4
Shouldn't you write /usr/bin/chromedriver (with a leading /)? - Willem Van Onsem
I just solved this problem with updating my crome, even though the version I was using was supported by the driver I was using. - HappyFace

4 Answers

20
votes

Adding some chrome options helped!

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome = webdriver.Chrome('/usr/local/bin/chromedriver', chrome_options=chrome_options)
5
votes

If you're using docker and getting this error I have the solution!

The cause of the problem is chrome running out of memory as documented here.

You have to add the flag "--shm-size=2g" to the docker run command.

1
votes

It is not enough to install chrome. You should have chrome web driver installed. You can refer this link for details on installation of chromedriver

How install chrome webdriver

0
votes

Try down grade chrome version. Download google-chrome old versions here: https://www.slimjet.com/chrome/google-chrome-old-version.php

I've verified the following working combination: google-chrome linux-v52 chromedriver 2.20.353124

jm