Cross Browser Automation using Gauge

Web Automation — Cross Browser

Osanda Deshan Nimalarathna
Test Automation Master
4 min readAug 26, 2018

--

Introduction

When you are developing a web based application, you will need to test it in multiple browsers and platforms. So if you are going to test all the functionalities in each browser manually, you may need a huge amount of time to complete those tests. Further, it may not gain any ROI (Return on invest).

Cross Browser Test Automation using Selenium WebDriver

To overcome that kind of situations, you will need to automate those tests with a customized driver class where all the drivers of the required browsers implemented.

Here I will guide you how to do that using Gauge framework.

I am not using any kind of geckodriver.exe to run the tests. It is not recommended to have .exe files on the project code base. Also it will not work in Ubuntu and Mac OS.

I am using Bonigarcia WebDriver Manager to implement the driver class.

Implementation

  1. First you need to add the below dependencies to your pom.xml

2. Then you need to add an environment property to the default.properties class inside the env/default folder.

default.properties

3. Below is the DriverFactory class I have implemented.

4. Next, implement the Driver class which uses DriverFactory methods inside execution hooks.

5. Here is a sample repository for you to get started.

Configurations

You may need to do below configurations if you need to use Internet Explorer 11 on Windows.

  1. Open Registry Editor (Windows Key + R → Type regedit → Press Enter).
  2. For 32-bit Windows installations, the key you must examine in the registry editor is
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
  3. For 64-bit Windows installations, the key is
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
  4. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present.
  5. Inside this key, create a DWORD value named iexplore.exe with the value of 0.
  6. Go to Internet Options on Internet Explorer.
Internet Options on Internet Explorer

7. Go to Security tab.

8. Check Enable Protected Mode for all zones (Internet, Local intranet, Trusted sites and Restricted sites).

Enabling Protected Mode for all zones

9. Click on Apply button.

10. Click on OK button.

I have tested this on Windows 10 Core i7 computer using the following browsers.

Tested browser stack

Execution

You can run the tests by executing the following command on the command prompt/terminal.
mvn test-compile gauge:execute -DspecsDir="<path_to_spec/s>" -Denv="<env>"

Ex: mvn test-compile gauge:execute -DspecsDir="specs/Login.spec" -Denv="QA"

Execution results will be saved inside reports folder. There will be mainly 3 types of reports available.

  1. HTML Report
  2. XML Report
  3. JSON Report
Sample HTML Report

Happy Automation !!!

--

--

Osanda Deshan Nimalarathna
Test Automation Master

Founder of MaxSoft | RPA Solution Architect | Open-source Contributor | Automation Framework Developer | Technical Specialist