Selenium chromedriver PATH error doesn't resolve


So I’ve been trying to follow this YouTube tutorial ( as a quick fun project to introduce myself to selenium, but I’ve already run into a problem. Whenever I run my code, I keep getting this error: ‘chromedriver’ executable needs to be in PATH. I’ve searched up the problem many times, moved chromedriver.exe to the C:/ directory to make things easier, and did all I can with the enviroment variables and still can’t figure this out. Please help me out!
Here’s the code I’m running

# This bot is made following this YouTube tutorial:
# All the import crap
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

driver = webdriver.Chrome("C:\\chromedriver.exe")

class InstaBot:

    def __init__(self, username, password):
        self.username = username
        self.password = password
        self.driver = webdriver.Chrome()

    def close_browser(self):

    def login(self):
        global driver
        driver = self.driver
        # "//a[@href'accounts/login']"
        # "//input[@name='username']"
        # "//input[@name='password']"

georgeIG = InstaBot("NotGonnaShowToStackOverflow", "NotGonnaShowToStackOverflow")

Here’s what I’ve tried with the environment variables.
enter image description here

enter image description here


In the video you linked to, the command pip install selenium will have handled the addition of the driver to the path.

I’m assuming you have tried to emulate this on windows and you’re having trouble understanding how the PATH variable is used. This related question on SO discusses how to register a .exe so it is available globally, which may help you.

You cannot register an executable directly in your PATH variable as you have done, your PATH should only contain directories. Try moving your chromedriver.exe file into one of the folders in your PATH and run your commands again.

Alternatively, you could create a folder such as c:\buildtools, add that to your PATH and then put chromedriver.exe in that folder and run your commands again.

Answered By – James G

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published