Search code examples
pythonseleniumselenium-chromedriverauto-py-to-exe

How can I use auto-py-to-exe on a program that uses selenium? - Chromedriver PATH error


Does anyone know how I can use auto-py-to-exe on a program that uses selenium?

I've been dealing with this for a few hours, I'm getting:

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

This is my code:

PATH = r'driver\chromedriver.exe'

op = webdriver.ChromeOptions()
op.add_argument('headless')
op.add_argument('--no-sandbox')
op.add_argument('--disable-dev-shm-usage')
global driver
driver = webdriver.Chrome(PATH, options=op)

It says the chromedriver.exe isn't in the path, but it is?? What am I doing wrong? I've followed so many red-herring tutorials that didn't work and I'm about to lose my mind over this.


Solution

  • So, I had to place chromedriver with the .exe file or somewhere like C:\driver\chromedriver.exe so it could be accessible from anywhere on my computer.