Select Page
Automation Testing

The Must-Know Basics of Selenium for Automation Testing

Understanding how a tool works helps you master it. In this blog, we cover the basics of Selenium to help you understand how it works.

Selenium is a web browser automation testing library that has evolved to become one of the most popular automation testing tools over the years all thanks to the various tools and libraries associated with it. If you are an experienced automation tester, you will be very familiar with Selenium and you can refer to our more advanced blog articles around Selenium. On the other hand, if you are a novice automation tester who isn’t very familiar with Selenium, we highly recommend you to read this blog and get to know the basics of Selenium. It is not a how-to guide, rather, it will help you understand how Selenium works. To become a master of any tool, it is always pivotal to understand how it works first. Let’s begin from Selenium RC and move forward to where we are now and help you understand how much Selenium has evolved.

Selenium RC

Selenium remote control (RC) was the first version of Selenium that is no longer in use. It had all the features we have in Selenium WebDriver except for the way it interacts with the browser & the webpage.

How did the Selenium RC work?

  • The Client code (Test Code) sends a Selenese command to the Selenium server using an HTTP request.
  • The server receives and finds the suitable Selenium-Core JavaScript command for the request.
  • Then the server interprets and injects a JavaScript snippet into the browser’s built-in JavaScript interpreter.

Selenium Remote Control

There were a few major downsides to Selenium remote control as well,

Disadvantages
  • It cannot mimic how a user performs actions on a browser since the server injects JavaScripts and manipulates the DOM. Let’s take the Chrome browser as an example. Chrome browser has pointer-events to listen to the user inputs from a touch screen, pen, or mouse. Here, the pointer-events are APIs of Chrome. Selenium RC will only manipulate the DOM using JavaScript and not access the browser API to execute the commands. That’s why Selenium RC does not have the capacity to emulate user actions.
  • The full strength of the Object-Oriented Programming was not adopted to Selenium RC.

Selenium WebDriver

WebDriver was developed by Simon Stewart at ThoughtWorks. WebDriver uses the Browser API instead of injecting JavaScript to perform the required actions. So Selenium and WebDriver were merged and released as Selenium 2.0. Local and Remote are two methods that are also few basics of Selenium that one must know. So let’s take a look at that now.

Local

Selenium WebDriver has drivers for each browser as every browser has its own engine. So the API implementation differs. When you want to automate a browser in the same machine where the test code is located, you wouldn’t need the Selenium Remote Server. Instead, your test code has to know where the browser driver is located. Once the driver location has been identified, it will start sending commands to the driver and the driver will begin interacting with the browser.

Selenium Webdriver local- Basics of Selenium

Remote

But at the same time, if you want to execute your test code on a Windows machine and launch Safari browser in Mac. You can start the Selenium Remote server in Mac and start the script execution from Windows. In this scenario, the test code and the browser are not in the same location. That’s why the remote server is coming into the picture.

Selenium Webdriver Remote

Selenium IDE

Selenium IDE is widely used to record test scripts. The Selenium IDE Legacy version is supported only on Firefox. The newer version of Selenium IDE does have plugins for Chrome & Firefox. Now let’s take a look at a few use cases and understand where Selenium IDE can be used.

Usage

  • If you are a beginner, you can use Selenium IDE to learn the Selenium commands.
  • You can also use it to quickly check whether you are able to automate a webpage or not without writing any snippets.

Selenium Grid

If you have multiple machines for test execution, you would have to start the remote server on all the machines. In addition to that, your test code needs to take the overhead to orchestrate IPs and Port numbers of all remote machines. This is where Selenium Grid comes into play and becomes one of the must-know basics of Selenium as it allows you to have a hub to which the nodes can be attached. Now your test code has to just send the commands to the hub and the hub will redirect the command to the appropriate nodes.

Basically, Hub takes the overhead of managing nodes and routing the command requests. So the Selenium Grid makes it easy to achieve parallel execution.

Selenium 4

If you have been following the topic, you will know that Selenium 4 has brought some notable features to the table. Selenium WebDriver has 60 plus endpoints to send and receive commands using the HTTP Protocol. So the Selenium client and server communicate with each other using the HTTP Protocol. But in order to implement the Chrome DevTools Protocol, Selenium 4 needs the Bi-directional protocol.

We, as one of the leading software test automation services providers, have used the browser console listener for a project. We wanted to capture all the JavaScript errors which are triggered on the browser. Yes, the Selenium 3 server does have the capability to receive the requests and send the responses. But when the browser sends a series of messages to the client via the server, the HTTP protocol isn’t enough to handle it. If you’re interested in finding out how we handled the bidirectional protocol, read our blog where to explain everything step-by-step.

Selenium 4 - Basics of Selenium

Conclusion

As stated earlier, this is not a how-to guide, and we hope that our approach of covering the basics of Selenium helped you get a crystal clear understanding of Selenium works. If you like what you have read, make sure to follow us on social media to get all the latest blog updates that happen over the week. QA Automation Testing Services is our core and in order to deliver the best service to our clients, we are on a path of continuous development. We have an R&D team to explore the new tool features, techniques, and so on. So it goes without saying that more informative articles are on the way.

Written By

Submit a Comment

Your email address will not be published. Required fields are marked *


Selenium is a web browser automation testing library that has evolved to become one of the most popular automation testing tools over the years all thanks to the various tools and libraries associated with it. If you are an experienced automation tester, you will be very familiar with Selenium and you can refer to our more advanced blog articles around Selenium. On the other hand, if you are a novice automation tester who isn’t very familiar with Selenium, we highly recommend you to read this blog and get to know the basics of Selenium. It is not a how-to guide, rather, it will help you understand how Selenium works. To become a master of any tool, it is always pivotal to understand how it works first. Let’s begin from Selenium RC and move forward to where we are now and help you understand how much Selenium has evolved.

Selenium RC

Selenium remote control (RC) was the first version of Selenium that is no longer in use. It had all the features we have in Selenium WebDriver except for the way it interacts with the browser & the webpage.

How did the Selenium RC work?

  • The Client code (Test Code) sends a Selenese command to the Selenium server using an HTTP request.
  • The server receives and finds the suitable Selenium-Core JavaScript command for the request.
  • Then the server interprets and injects a JavaScript snippet into the browser’s built-in JavaScript interpreter.

Selenium Remote Control

There were a few major downsides to Selenium remote control as well,

Disadvantages
  • It cannot mimic how a user performs actions on a browser since the server injects JavaScripts and manipulates the DOM. Let’s take the Chrome browser as an example. Chrome browser has pointer-events to listen to the user inputs from a touch screen, pen, or mouse. Here, the pointer-events are APIs of Chrome. Selenium RC will only manipulate the DOM using JavaScript and not access the browser API to execute the commands. That’s why Selenium RC does not have the capacity to emulate user actions.
  • The full strength of the Object-Oriented Programming was not adopted to Selenium RC.

Selenium WebDriver

WebDriver was developed by Simon Stewart at ThoughtWorks. WebDriver uses the Browser API instead of injecting JavaScript to perform the required actions. So Selenium and WebDriver were merged and released as Selenium 2.0. Local and Remote are two methods that are also few basics of Selenium that one must know. So let’s take a look at that now.

Local

Selenium WebDriver has drivers for each browser as every browser has its own engine. So the API implementation differs. When you want to automate a browser in the same machine where the test code is located, you wouldn’t need the Selenium Remote Server. Instead, your test code has to know where the browser driver is located. Once the driver location has been identified, it will start sending commands to the driver and the driver will begin interacting with the browser.

Selenium Webdriver local- Basics of Selenium

Remote

But at the same time, if you want to execute your test code on a Windows machine and launch Safari browser in Mac. You can start the Selenium Remote server in Mac and start the script execution from Windows. In this scenario, the test code and the browser are not in the same location. That’s why the remote server is coming into the picture.

Selenium Webdriver Remote

Selenium IDE

Selenium IDE is widely used to record test scripts. The Selenium IDE Legacy version is supported only on Firefox. The newer version of Selenium IDE does have plugins for Chrome & Firefox. Now let’s take a look at a few use cases and understand where Selenium IDE can be used.

Usage

  • If you are a beginner, you can use Selenium IDE to learn the Selenium commands.
  • You can also use it to quickly check whether you are able to automate a webpage or not without writing any snippets.

Selenium Grid

If you have multiple machines for test execution, you would have to start the remote server on all the machines. In addition to that, your test code needs to take the overhead to orchestrate IPs and Port numbers of all remote machines. This is where Selenium Grid comes into play and becomes one of the must-know basics of Selenium as it allows you to have a hub to which the nodes can be attached. Now your test code has to just send the commands to the hub and the hub will redirect the command to the appropriate nodes.

Basically, Hub takes the overhead of managing nodes and routing the command requests. So the Selenium Grid makes it easy to achieve parallel execution.

Selenium 4

If you have been following the topic, you will know that Selenium 4 has brought some notable features to the table. Selenium WebDriver has 60 plus endpoints to send and receive commands using the HTTP Protocol. So the Selenium client and server communicate with each other using the HTTP Protocol. But in order to implement the Chrome DevTools Protocol, Selenium 4 needs the Bi-directional protocol.

We, as one of the leading software test automation services providers, have used the browser console listener for a project. We wanted to capture all the JavaScript errors which are triggered on the browser. Yes, the Selenium 3 server does have the capability to receive the requests and send the responses. But when the browser sends a series of messages to the client via the server, the HTTP protocol isn’t enough to handle it. If you’re interested in finding out how we handled the bidirectional protocol, read our blog where to explain everything step-by-step.

Selenium 4 - Basics of Selenium

Conclusion

As stated earlier, this is not a how-to guide, and we hope that our approach of covering the basics of Selenium helped you get a crystal clear understanding of Selenium works. If you like what you have read, make sure to follow us on social media to get all the latest blog updates that happen over the week. QA Automation Testing Services is our core and in order to deliver the best service to our clients, we are on a path of continuous development. We have an R&D team to explore the new tool features, techniques, and so on. So it goes without saying that more informative articles are on the way.