1

I have the webdriver and selenium installed. When I try to run a code to just open google, I get this error. I have tried adding the .exe to the path many times, but it isn't working.

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

Caleb Swartz
  • 31
  • 1
  • 1
  • 2

2 Answers2

3

Now you can set chromedriver for auto upgradation :

pip install chromedriver-autoinstaller

code :

from selenium import webdriver
import chromedriver_autoinstaller


chromedriver_autoinstaller.install()  # Check if the current version of chromedriver exists
                                      # and if it doesn't exist, download it automatically,
                                      # then add chromedriver to path

driver = webdriver.Chrome()
driver.get("http://www.python.org")
assert "Python" in driver.title

try the below code for manual setup :

driver = webdriver.Chrome("full path to chrome driver\\chromedriver.exe")
driver.maximize_window()
wait = WebDriverWait(driver, 30)
driver.get("www.google.com")
cruisepandey
  • 28,520
  • 6
  • 20
  • 38
2

Install the driver at the time of execution.
Using the webdriver_manager python package will store this into a cache and pass the exact path to the driver.
It will only download if a newer driver version exists.

import selenium
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())
deseuler
  • 408
  • 2
  • 8