0
votes

Selenium installed using pip.

Trying to run below code :

import selenium

from selenium import webdriver

\#driver = webdriver.Chrome()

driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')

time.sleep(5)

driver.quit()

What I get:

python 5formscrape-selenium.py

Traceback (most recent call last):

File "5formscrape-selenium.py", line 5, in driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 62, in init self.service.start()

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 81, 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

$PATH contains /usr/bin/chromedriver

chromedriver file is in /usr/bin with privileges

sudo chmod a*x chromedriver 

So what I'm missing here?

1

1 Answers

0
votes

chromdriver needs to be in PATH means the directory in which it is present should be in PATH and not the whole PATH itself. Change

$PATH=/usr/bin/chromedriver:....

to

$PATH=/usr/bin/:....

Remove chromedriver, so selenium can search for chromedriver in /usr/bin