1
votes

My code

from selenium import webdriver
dr = webdriver.Chrome()
dr.close()

I got this error

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

2

2 Answers

0
votes

The error is telling you what is wrong: the chromedriver program is not found in your executable path (stored in the environment as $PATH).

You can tell what the current path is using something like this:

import os
print os.environ['PATH']

Once you know the path, you can install chromedriver into one of the directories in the path.

0
votes

The correct solution would be to just add the path of your chrome driver. The best way to do that is just have the chrome driver in the same directory as you are probably going to be updating it a lot since google is still working on it.