14

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

karolisb
  • 403
  • 1
  • 3
  • 9

4 Answers4

24

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)
karolisb
  • 403
  • 1
  • 3
  • 9
  • 1
    The path is different here. I think it is not the options that did the trick, but the path might be incorrect earlier . Check the path you gave in the comment under my answer. It is different. – Mohammed Shareef C Mar 25 '17 at 12:12
  • 1
    I've tried both paths, and only adding those options did the trick – karolisb Apr 10 '17 at 10:50
10

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.

Minmo
  • 143
  • 3
  • 6
1

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

Mohammed Shareef C
  • 3,829
  • 25
  • 35
0

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

JM_BJ
  • 41
  • 1
  • 2