How to install Selenium WebDriver on Mac OS?

We can install Selenium on Mac OS. We shall take the help of Homebrew package manager for installation in Mac OS. Let us follow the step by step process −

  • Install Selenium by running the command −

pip install selenium
  • Install the Chrome driver with the homebrew by running the command −

brew cask install chromedriver
  • Verify the version of the Chrome driver, by running the command −

chromedriver −−version
  • Create a test script and try to execute after save.

from selenium import webdriver
# driver initialization
driver = webdriver.Chrome(executable_path="C:\chromedriver.exe")
# launch URL
  • If the below error is triggered −

unknown error: cannot find chrome binary

It means the version of the Chrome driver is not compatible with the Chrome browser version we are using. We have to uninstall the Chrome and then downgrade or upgrade the browser as per the driver we have.

Updated on: 30-Nov-2020

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started