Unknown error: cannot find chrome binary when running selenium under Linux

For Linux system, running Selnium script will report the following error

Traceback (most recent call last):
  File "./obp_pb_get_csv.py", line 73, in <module>
    browser = webdriver.Chrome('/usr/bin/chromium') # Get local session of chrome
  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 46, in __init__
  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/service.py", line 64, in start
    raise WebDriverException("Can not connect to the ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'Can not connect to the ChromeDriver'


1. Confirm whether Chrome browser is installed, command: Chrome browser - version 0

2. If not, use the following command to install: sudo apt get install chromium browser

3. Get chromedriver and visit the following link http://chromedriver.storage.googleapis.com/index.html

4. Decompress Chromdriver.zip

5. Move the file to the path/usr/bin, command: sudo MV chromedriver/usr/bin

6. Switch to/usr/bin directory, command: CD/usr/bin

7. Make it executable, command: sudo Chmod a + X chromedriver

8. Perform the following code tests:

from selenium import webdriver

driver = webdriver.Chrome()
print driver.page_source.encode('utf-8')


Read More: