No such file or directory: 'chromedriver.exe'

Why i have this error even though i have the chromedriver.exe in the same directory as my python file

FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver.exe'

  def login(self):
    chrome_driver_path = 'chromedriver.exe'
    options = webdriver.ChromeOptions()
    # Run in headless mode without opening a browser window
    options.add_argument('--headless')  # Run in headless mode
    # Disable GPU for headless mode
    service = webdriver.ChromeService(executable_path=chrome_driver_path)
    browser = webdriver.Chrome(service=service)


This may be because the file isn’t on the root!
Try putting ./ behind chromedriver.exe, like so: ./chromedriver.exe
Otherwise, you may need path to route to the path!

Hope this helps!

In this case, even if it can find it, it’ll still fail, since Linux cannot run .exe files. (I’m aware wine exists, but that wouldn’t help here)

oh, i didn’t realize replit uses linux, so i downloaded the linux version of chromedriver
but i’m getting this error now
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions.

chrome_driver_path = './chromedriver'


1 Like

run in Shell

chmod +x chromedriver