Blog / Java Selenium

Java Selenium

July 18, 2021



An automation tool - Selenium

Selenium is a WebDriver that would support the automation of web browsers. Below is the internal architecture of working of selenium.

Based on above architecture, there are 3 main units

  • Selenium Binding Languages: to support multiple clients, who develop in different scripts.

  • JSON Wire Protocol: to convert into a unified script from these multiple languages and transfer data to webdrivers. Visit JsonWireProtocol to know how the requests are designed.

  • WebDrivers and Browsers: The JSON data is fed to the browser driver and using a HTTP server it communicates with actual browser. The communication is in the form of REQUEST and RESPONSE, like how REST api’s do.

Setting up selenium

  • Using Maven it is pretty straightforward, you can visit the MVNRepository. Note this selenium-java dependency all Selenium supported browsers, but if you want specific then alter your pom.xml file.
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>4.0.0-alpha-7</version>
</dependency>
  • Using the jar files, then go to SeleniumHQ Downloads and get the WebDrivers for your browser and add into the project libraries.

Visit the Selenium Documentation

Please check the Selenium Documentation for detailed information. Also, there is an option to record and playback test cases, you can check the Selenium IDE.

How I came across Java Selenium ?

There was a time when my team was overloaded with issues. Issue complexity was trivial, it was more related to GUI and languages. After resolving each issue, we had to log our effors in REDMINE with all the data. So to log these issues, we wanted to automate the process so as to reduce the work load. The idea was to fill a shared Excel sheet and use that as input to log our team efforts. So we used Selenium for that to read the excel and use the data to fill in redmine.

References

  1. Selenium WebDriver - Simon Stewart
  2. How Selenium-WebDriver API commands work?
  3. JsonWireProtocol