Search code examples
pythonmacosseleniumwebdriverselenium-chromedriver

Selenium chromedriver in relative path for mac and python


I am trying to get selenium to use chromedriver on mac.

I have downloaded the mac version of chromedriver and added it to the same folder as my python file. I am then using:

driver = webdriver.Chrome()

however it doesn't seem to be opening.

This works fine in windows but just not working on mac. anyone got any ideas?

Thanks


Solution

  • You either have to provide a path to binary when creating an instance of webdrive.Chrome():

    chromedriver = "/path/to/chromedriver/folder"
    driver = webdriver.Chrome(chromedriver)
    

    or chromedriver has to be in you PATH. You can add chromedriver to PATH with

    export PATH=$PATH:/path/to/chromedriver/folder