Getting Chrome in PATH

I followed the steps in Installing Headless chromium w/o docker - #5 and put export PATH="${PATH}:/opt/render/project/.render/chrome/opt/google/chrome/" in my start command, but I’m still getting the error Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

I even tried including the chromedriver.exe in the directory of my repo, and I’m still getting the same error.

here’s the setup code for selenium in my script if that’s helpful:

def setup():
   print('--->Setup selenium start : ' + str(datetime.now()))
   chrome_options = Options()
   chrome_options.add_argument('--no-sandbox')
   chrome_options.add_argument('--disable-dev-shm-usage')
   chrome_options.add_argument('--force-dark-mode')
   chrome_options.add_argument("--start-maximized")
            
   capabilities = {
                # "resolution": "2560X1440"
                # "resolution": "1280X720"
                "resolution": "768X432"
   }
   driver = webdriver.Chrome(options=chrome_options,
                                  desired_capabilities=capabilities)
   print('Setup selenium complete')
   return driver

Any advice appreciated!

After running the build and start of this topic:

you need to install webdriver-manager: $pip install webdriver-manager.
and with that increment it should work:

from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service

service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)

Hope this helps :+1:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.