Selenium is great for Automated Testing - I thought I’d revisit my old testing tools and so this is an update for 2020 and covers the basics of installing Selenium, Chromedriver with Python on a Mac.

Previously, my testing was done in Selenium IDE, but you really need to automate this for cross-browser testing which is why you’ll need to download and install Selenium on your Mac.

I’ll guide you to

  • install the software that you need
  • create a basic test from your terminal

Install the software

  1. You can head over to the Chromedriver Project page and download the latest package or you can use Homebrew. If you don’t have Homebrew, go install it.

Install ChromeDriver with Brew cask install chromedriver

  1. Next we need the latest Python. I’m using a brand new 2020 Macbook Air and it has the out of date v2.x installed so go ahead and install the latest 3.x with: Brew install Python

As a note you now (probably) have both Python2 and Python3 on your Mac - so we are going to use Python3

  1. Now you can install Selenium with: Pip3 install -U selenium

Pip3 is the package install manager for Python3

Basic Test Case for Chromedriver and Selenium

Having completed these steps, you can now run a basic test - you need to have Chrome installed on your mac for this to work

Open a terminal window and enter python3 to start Python …

Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Type the following, pressing enter at the end of each line

from selenium import webdriver
driver = webdriver.Chrome()

After a few seconds, if all is well a new instance of Chrome will open

To exit Python from your open Terminal, type exit() and press enter

Tags: Selenium, Testing, Chromedriver

Contact me today to find out how I can help you.

Meet the author

Photo for Damien Saunders
Damien Saunders
An experienced management consultant and business leader interested in digital transformation, product centred design and scaled agile. If I'm not writing about living with UCTD (an autoimmune disease), I'm probably listening to music, reading a book or learning more about wine.