Sunday, 25 February 2018

Installing Watir and Python Selenium on macOS

I have been using Watir on and off for quite a long time, seeing it develop from Watir through Watir-Webdriver and back to Watir. I needed to install its latest incarnation and hit a few problems. The problems were caused more by my impatience in not reading through the notes on the Watir website than anything else.

At the same time, I decided to install the Python Selenium package to try it out. It also didn't work out of the box. Once again, the problem was that I hadn't been sufficiently thorough in reading the instructions.

The main problem with both was the need to install the Firefox and Chrome web drivers and to configure Safari's. After a little trial and error and reading through  the documents, the simplest way came to the surface.

I installed the Firefox and Chrome web drivers using Homebrew: 
    brew install geckodriver
    brew install chromedriver

My Safari installation was already configured to show the Develop menu and I have Allow Remote Automation menu item selected. From the Watir Safari Driver page, I found that I need to run safaridriver once from the command line to give it the proper authorities. I needed to run it from an administrator account:
     sudo /usr/bin/safaridriver

After that both Watir and Python Selenium both will happily load Safari, Firefox and Chrome when run from a macOS user account.