Watir - Installing Drivers for Browsers



In this chapter, we are going to install browser drivers that we need to test our project using Watir. Prior to Watir 6, we had to include watir-webdriver to use the browser drivers. With the release of Watir 6, the watir-webdriver is available as part of Watir package and users do not have to add the watir-webdriver separately.

The browsers like Chrome, Firefox, and Safari are available by default and you do not have to add them externally. Incase while testing you get an issue that the driver for the browser is not available, you can always download them as instructed below.

We are going to install drivers for following browsers −

  • Driver for Browsers - Chrome
  • Driver for Browsers - Firefox
  • Driver for Browsers - Edge
  • Driver for Browsers - Internet Explorer
  • Driver for Browsers - Safari

Driver for Browser - Chrome

To get the driver for chrome browser, go to − https://sites.google.com/a/chromium.org/chromedriver/downloads.

Driver Browser

Check the version of your browser and accordingly download the Chrome driver. To check the version of your chrome browser, do as shown here −

Chrome driver

Click on About Google Chrome and it will give you the chrome version as shown below −

Chrome Version

So our version is 74. So, download chrome driver version 74.

Download Chrome Driver

Next, download the chrome driver depending on your operating system. We will download chromedriver_win32.zip, it is meant for both 32-bit and 64-bit machines. In case you are planning to use the driver downloaded, add the location somewhere on your PATH variable.

Driver for Browser - Firefox

For Firefox driver, go to − https://github.com/mozilla/geckodriver/releases as shown in the screenshot below −

Download Firefox

As per your operating system, download the driver as shown above. In case you planning to use the driver downloaded, add the location somewhere on your PATH variable.

Driver for Browser - Edge

For Firefox driver, go to − https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ as shown in the screenshot below −

Driver Browser Edge

Click on the Version of Microsoft Edge you have as shown below −

Microsoft Edge

Click on Release link and it will redirect you to −

Version Number

Here, you can find the download version available for windows. In case you are planning to use the driver downloaded, add the location somewhere on your PATH variable.

Driver for Browser - Internet Explorer

To install the driver for Internet Explorer go to − https://docs.seleniumhq.org/download/ as shown below −

Internet Explorer

The details for the download section on IE are shown here −

Download Section

As per your OS, download the 32 or 64 bit windows IE. Also add the location to you PATH variable to make use of the driver.

Drivers for Browsers - Safari

The drivers for safari are not required to be downloaded externally for safari version 10 onwards. They are downloaded along with the gem package while installing Watir.

Please note that drivers for Chrome, Firefox, Internet Explorer are also available when Watir is installed. But incase if you face any issues and need a specific version to be tested, you can download them as per your browser and update the location in PATH to make use of it in testing your application.

Advertisements