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
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)
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
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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.