• Selenium Video Tutorials

Selenium WebDriver vs RC



There exist many differences between Selenium Webdriver and Selenium RC. Though both these tools help in creating automation tests using various programming languages, they are different in many ways.

Selenium WebDriver

Selenium WebDriver is the successor to Selenium Remote Control which sends commands directly to the browser and retrieves results. Let us now discuss the architecture of Selenium Webdriver.

Selenium WebDriver Architecture

Selenium Web Driver architecture in a simplified diagram is described below −

Selenium Vs RC 1

From the Selenium 4 version, the entire architecture is fully compatible with W3C - World Wide Consortium meaning Selenium 4 follows all the standards and guidelines given by W3C. We can get more information about W3C from the below link −

https://www.tutorialspoint.com/world-wide-web-consortium-w3c.

Selenium Webdriver architecture is straightforward. It does not require any proxy server and communicates directly with the browser. Only an IDE is required to develop the code for the tests, and a browser on which those tests would be performed.

Selenium WebDriver API enables interaction between browsers and browser drivers. This architecture consists of four layers namely the Selenium Client Library, W3C Protocol, Browser Drivers and Browsers. Since the browsers, browser drivers, and Selenium webdriver are compliant with W3C protocols, hence the interaction between the client libraries and the browser drivers are more efficient, faster, reliable, and stable.

  • Selenium Client Library consists of languages like Java, Ruby, Python, C# and so on. A test case written in any language is used to send the command to interact with the browsers.

  • After the code is triggered, it will be converted to Json or other standard similar formats by the client as per the W3C protocol.

  • W3C protocol is used for the task of transferring information from the server to the client. The browser drivers act as a link between the client and browser. The browser drivers have the serialized request which is actually performed on the browsers. Browser drivers interact with their respective browsers and execute the commands by interpreting Json. As soon as the browser drivers get any instructions, they run them on the browsers. Then the response is given back in the form of HTTP response.

  • The browser drivers also serialize the response it receives in a standardized format as per W3C protocols and send it back to the client. Then the client would deserialize the responses it received to confirm if there is a successful execution of the command request.

Let’s consider the below block of code −

WebDriver driver = new ChromeDriver();
driver.get (“https://www.tutorialspoint.com/selenium/practice/selenium_automation_practice.php“);

Once we run this block of code, the entire code will be converted to JSON or any other standard formats as per W3C protocols over HTTP as a URL. The converted URL will be fed to the ChromeDriver.

The browser driver utilizes HTTP server to get the request from HTTP. As the browser driver gets the URL, it passes the request to its browser via HTTP. It will trigger the event of executing the Selenium instructions on the browser.

Now if the request is that of POST, it will trigger an action on the browser. If it’s a GET request, then the response will be produced at the browser end. Finally it will be passed over HTTP to the browser driver. The browser driver will in turn send it to the UI.

Selenium Remote Control (RC)

Selenium Remote Control is a server implemented in Java. Selenium Remote Control (RC) was the flagship testing framework that allowed more than simple browser actions and linear execution. It can accept commands for browsers using the HTTP. Selenium Remote Control has a Selenium Remote Control server and a Selenium Remote Control client. In the current version of Selenium, Selenium RC is outdated and it has been deprecated by Selenium.

Selenium Remote Control Architecture

Let us now discuss the architecture of Selenium Remote Control. Selenium Remote Control architecture in a simplified diagram is described below −

Selenium Vs RC 2

Selenium Remote Control architecture is not straightforward. In order to trigger tests in Selenium Remote Control, we would need to install and set up the Remote Control Server in our system. It is similar to a bridge between the web browser and the commands. Selenium Remote Control server puts the Selenium Core (a program in JavaScript) within the browser. Post this, the Selenium Core gets the message from the Selenium Remote Control server as per tests in the form of JavaScript commands. The browsers perform the commands received from the Selenium Core, and send test responses back to the server.

Thus the architecture on which Selenium Remote Control is built makes the test execution slow, as it is based on the Selenium Core, which is a JavaScript language.

This sums up the overall explanation of the Selenium WebDriver Architecture.

Difference Between Selenium WebDriver and Remote Control (RC)

The basic difference between the Selenium Remote Control and Selenium Webdriver are listed below −

Features Selenium Webdriver Selenium RC
Architecture Simple and straightforward Complex with client and server
Server No server is required to start test execution A server is required to start test execution
API Has stronger APIs. Has weeker APIs.
Recording Cannot be used for recording purposes Can be used for recording purposes.
Headless Supports headless execution using the HTMLUnit browser No support for headless execution.
iPhone/Android Capable of testing mobile devices using the Android Driver and iPhone Driver Not capable of testing iPhone/Android mobile devices
Report Not capable of report generation by default Report generation in html format is available by default
Performance Fast as it communicates straight with the browser Not as fast as the Selenium webdriver because it does not communicate straight with the browser.
OOP Based entirely on OOP Based not entirely on OOP
Browser Support Not readily stable while supporting new browsers Stable while supporting new browsers
User Interaction Capable of handling cursor and mouse actions Not capable of handling cursor and mouse actions
Ease More complicated to understand with respect to developing tests Less complicated to understand with respect to developing tests
Advertisements