Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 622
Jamie Smith Avatar asked Dec 05 '25 18:12

Jamie Smith


2 Answers

You might need to install it with : brew install chromedriver --cask or brew install chromedriver

and then do which chromedriver

You will get the relevant path.

like image 83
JohnBegood Avatar answered Dec 08 '25 15:12

JohnBegood


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
like image 33
pythad Avatar answered Dec 08 '25 15:12

pythad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!