Installing Selenium Webdriver on Your Mac
I spent a good amount of my weekend struggling to install Selenium webdriver on my macbook for a tech challenge for a web automation engineer interview. Learning to use a new tool almost always presents me with new challenges but installation problems are just the WORST because it feels like something that should be done so easily. I spent hours trying out different solutions posted online, even the ones dating back to 2015 but nothing worked, until I found this helpful advice.
So the first few steps of Selenium webdriver installation is pretty easy and straight forward.
- If you are planning to use Selenium with Node.js, you can
npm install selenium-webdriver
on your terminal, and if you are using Selenium with Python, you canpip3 install selenium
on your terminal. - Go to this Selenium doc to download the webdriver for the browser of your choice(I used chromedriver)
3. Check the version of your browser(Chrome in my case), download the file corresponding to your version, unzip the download file.
4. This is where is got tricky for me and where I had to spend hours on. What the official documentation and most of the web tutorials tell you to do is to add the webdriver to your system PATH by using terminal commands. There are many different ways(and slightly different commands depending on your OS) to go about it but none worked me. But don’t worry, because I found a super easy way to do it after hours of Google searches and trial and error. On your finder, select ‘Go’ tab and click on ‘Go to folder’:
And then type in ‘/usr/local/bin’ and press ‘Go’ to go to bin folder:
‘bin’ folder will open up and all you have left to do is to move your ‘chromedriver’ file to the bin folder:
5. Click on chromedriver file to run it
Simple enough right? I hope this helps you install Selenium webdriver onto your mac easily!