Why compatibility testing?

Compatibility testing is one of the popular software testing done to check the UI variations of the web application in multiple browsers. Example, noticeable change can be witnessed when comparing an application with chrome and IE.

Advantages of using Selenium for compatibility testing:

  • An open source tool for automation testing which supports web automation.
  • It supports platforms such as Windows, Linux, and Mac OS X.
  • Scripting languages such as Java, C#, Python, Ruby, Perl, PHP and JavaScript are supported.
  • Selenium along with Appium can be used for the device testing.
  • AutoIt can help selenium to carry out few desktop operations.

Selenium Grid:

Selenium Grid is used to run a test on multiple browser or machine at the same time. This helps to run the test cases in parallel.

The parallel testing helps to reduce time by running the test cases in multiple combinations of OS and browser at the same time.

The testing time is reduced while implementing the grid concept in test automation.

Cloud-based parallel testing is also possible (BrowserStack), the operating system and browsers available in the cloud are up to date. These can be helpful in testing the web application on the recent update and it is cost effective that it need not be installed in the available machine.

Configuring Grid:

In order to run the test cases parallel, we need to implement the concept of hub and node in our configuration

Consider we are going to run the scripts in three machines, the one machine which has the test scripts will act as the central hub and run the tests, and the browser is launched and execution starts on all the three machines.

Hub – This is the central part in which ‘n’ number of nodes can be attached to it. There should be only one hub in the grid configuration.

To start a hub, command needs to be executed from the command line. The command prompt needs to be opened from the path where the selenium jar is available.

   Command for starting HUB:

 java -jar selenium-server-standalone-3.4.0.jar -role hub

The above command will run the hub on the default port 4444

In order to change the default browser 4444 and need to execute on other port (Ex-5555), below command needs to be executed.

java -jar selenium-server-standalone-2.48.2.jar -role hub –port 5555 The above command will run successfully and start the hub on the system and gives the success message at the end stating “Selenium Grid hub is up and running” Node: This is where our scripts are going run. The node can be a physical or virtual machine. When we successfully register the node with the Hub, the hub will know the details of the node and we can also see that the node details in the command prompt where we have launched the hub. 

To start a node, the command needs to be executed from the command line. The command prompt needs to be opened from the path where the selenium jar is available.

   Command for starting Node:

 java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register -port 2222

If you are launching the node in the same machine as in your hub you can specify ‘localhost’ as seen in the above command, but if your node is in some other machine you need to replace the local host in the above command with the system IP of the hub machine.

We can check whether the node launch is successful by verifying the details in the hub prompt. The registered node (2222) will be displayed in the hub.

2222 is the unique port to register the node with the hub. There cannot be two nodes using the same port number.

The browser details can also be mentioned in the node by adding -browser browserName=chrome to the above command

Hub/Node Batch file:

In order to simplify the hub node creation, we can add the command for the hub and node in the .bat file. When we execute the bat file hub and the node will be created respectively.

Below is an example to launch hub and two nodes in the same machine, the node command can be customized to add the browser details in it.

cmd /C start/MIN java -jar “D:\selenium-server-standalone-3.5.0.jar” -role hub

cmd /C start/MIN java -jar “D:\ selenium-server-standalone-3.5.0.jar” -role node -hub http://localhost:4444/grid/register -port 8546

cmd /C start/MIN java -jar “D:\selenium-server-standalone-3.5.0.jar” -role node -hub http://localhost:4444/grid/register -port 9840

The above 3 commands can be saved in the txt file with .bat as the extension. Once this file is executed the hub and node are launched with the given data.

Note: For Linux, you need to create shell script instead of bat file.

Testing on the Cloud

Example: Cross-Browser Testing:

With the help of DesiredCapabilites and the RemoteWebDriver we can achieve executing the tests on various browser and machines.


  • The OS and browser type will be set using DesiredCapabilites.
  • There is a number of DesiredCapabilites methods in which setCapability method is used to set the device name, app name and activity name in case of mobile testing, and all the other mobile related details.


  • The node or machine in which the execution needs to be carried out can be set with the RemoteWebDriver.
  • Using of WebDriver instead of RemoteWebDriver will make the selenium assume that the execution is going to be done in the local machine. But using the RemoteWebDriver we need to mention where the hub and node are present and in which browser the execution is going to take place.

Sample code of how the RemoteWebDriver and DesiredCapabilites contribute to the grid is given below.

DesiredCapabilities capability = DesiredCapabilities.firefox();capability.setBrowserName(“firefox”);

driver = new RemoteWebDriver(new URL(“”),capability);

Testing for Compatibility testing:

  • Testng uses annotations in java in order to carry out the testing and grouping.
  • Testng framework supports parallel testing, and this need not have a specific code to handle the same.
  • It requires xml file for test configuration

Let’s consider an example below to execute the tests on BrowserStack

(BrowserStack – It is cloud-based testing which supports both manual and automation on a different browser and operating system. We can sign-up for a free trial and obtain the unique UserName and Access Key)


Thus Selenium is the versatile tool for the compatibility testing in any operating system, not just for local execution but also for cloud-based service providers such as cross-browser testing.

Login/Register access is temporary disabled