-1

I have Chromium on my computer that runs Debian 9. Here's scraper.py:

from selenium import webdriver
import time

options = webdriver.ChromeOptions()
options.add_argument("--ignore-certificate-errors")
options.add_argument("--test-type")
options.binary_location = "/usr/bin/chromium"

driver = webdriver.Chrome(chrome_options=options)
driver.get("https://python.org")

The Chromium binary is at the specified location. When I run python scraper.py, I get this error.

Traceback (most recent call last):
  File "scraper.py", line 9, in <module>
    driver = webdriver.Chrome(chrome_options=options)
  File "/home/me/ENV/pbc_vss/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
    self.service.start()
  File "/home/me/ENV/pbc_vss/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Username
  • 3,463
  • 11
  • 68
  • 111

2 Answers2

3

specify the path where your chrome driver is located, download page https://sites.google.com/a/chromium.org/chromedriver/downloads

driver = webdriver.Chrome(executable_path='/path/to/driver/chromedriver')
ergesto
  • 367
  • 1
  • 8
1

Your browser binary (in this case, for chromium) is not the same thing as your chromedriver. Just having the binary means you can launch chromium yourself, for example, but webdrivers will not be able to launch their own instances of chrom(e/ium), thus preventing you from using selenium with them. The solution to this is to download a chromedriver executable of your choice (note that version may be significant) in a folder on your path, or directly supply the path when creating your webdriver.