Drivers

All the browsers now require a driver in order to send and receive WebDriver commands.
These are now all maintained by the browsers vendors (IE being the exception).

Setting up Drivers

Before I tell you where to find all the drivers you’ll need, I want to tell you how you use them.
There are many ways to inform Selenium on the location of the drivers. Choose the one that works best for you.

PATH, on a windows machine we can add the full path to the ChromeDriver.exe to our environment variables PATH.

Bin folders. On a Mac, we can add the Drivers to either /usr/bin or /usr/bin/local.

Specific to Java, we can also set system properties to instruct Selenium on the path of the driver

You can also use Driver options, we’re going to look at them in another lesson.

Chrome

We’ll start with Chrome, as that is currently my default browser.
In order to automate Chrome, you need to download ChromeDriver.
Make sure you download the correct version for your machine.

If you’re going to use the system property approach the key is called ‘webdriver.chrome.driver’.

Firefox

If you’re going to use the system property approach the key is called ‘webdriver.gecko.driver’.

SafariDriver

In order to automate Safari, you don’t need to download a driver! It’s already included in MacOS. But you do need to enable some settings.

Firstly, we need to enable developer mode in Safari if you haven’t already.
Open Safari preferences and go to the advanced tab, and at the bottom check ‘Show Develop menu in menu bar’.

Secondly, we need to enable ‘Allow Remote Automation’. We do this by going to the newly added Develop menu and check it, it’s near the bottom of the list
You will now be able to follow the code example above to open Safari with WebDriver.

Edge

To automate EDGE, firstly you need to be on a Windows 10 machine and download the EDGEDriver

If you’re going to use the system property approach the key is called ‘webdriver.edge.driver’.

Internet Explorer

To automate IE, you first have to say huge thanks to Jim Evans!
You then need to download the IEDriver.

If you’re going to use the system property approach the key is called ‘webdriver.ie.driver’.