-1

I have been trying to learn the basics of Selenium for a couple days now, and I have kept running into the same roadblock.

The error :

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

keeps appearing despite the fact that the chromedriver and my python code are in the same folder. Is there any way to fix this? The code I am running is here:

    import time
    from selenium import webdriver

    driver = webdriver.Chrome()  # Optional argument, if not specified will search path.
    driver.get('http://www.google.com/');
G_real
  • 1,137
  • 1
  • 18
  • 28
Ali Hindy
  • 1
  • 1
  • _"keeps appearing despite the fact that the chromedriver and my python code are in the same folder."_ - that is not what the error message is telling you to do. – Bryan Oakley Jan 23 '20 at 23:06

1 Answers1

2

You can add executable_path to your webdriver.Chrome() declaration and provide the full path of where chromedriver.exe is located:

driver = webdriver.Chrome(executable_path="/usr/path/to/chromedriver.exe")

The string in executable_path will need to be replaced with whatever the absolute path in your system is to the chromedriver executable.

CEH
  • 5,701
  • 2
  • 16
  • 40