In the past chapters, we learnt about “How To Enhance A Script Using Selenium IDE?” and created simple tests using it. In today’s chapter, we are going to learn about Selenium WebDriver which is an advance tool and a mechanism to create more powerful test scripts than Selenium IDE.
It is web automation testing framework that assists to execute tests across various web browsers. Thus, it is more flexible and powerful framework to write web testing automation scripts. Selenium WebDriver supports HTMLUnit and Firefox by default and other browser such as Internet Explorer, Safari, PhantomJS, Opera and Chrome with additional component known as Driver Server.
Browser Support by Selenium WebDriver:
Unlike Selenium IDE, WebDrivers can be used to write tests using various programming languages such as Java, .Net, etc. With the use of programming language, we need not to just rely on the in-built functions sincewe can leverage programming language features such as conditional operations (if-else or switch-case-default statements), looping (for-loop, while-loop), constant and variables declarations, etc. Following are the programming languages that are supported by the Selenium WebDrivers:
Therefore, choose the programming language that you understand well while working with Selenium WebDriver. In this tutorial, we are going to use JAVA as programming language and Eclipse as IDE.
WebDriver vs Selenium RC:
Selenium RC exists before Selenium WebDriver back in 2006. Both have the common features givenas follows.
- Test scripts can be written in different programming languages.
- Tests can be executed across different web browsers.
Now the question should be, what is the actual difference? To understand that let’s take a look at Selenium RC architecture.
Selenium RC (Remote-Control) Architecture:
- A remote control server that launches and kills web browsers and behaves as a HTTP proxy for different web requests from them
- Client libraries that supports different programming languages.
Following points to be remembered about Selenium RC’s architecture.
- Before we can start actual testing, we need to launch a separate application called Selenium Remote (RC) Server.
- From the architecture diagram, it is clear that RC Server is a middle layer between our Selenium commands and browser.
- The browser receives the instructions from Selenium Core and relays its response to the Selenium RC Server.
- Using the response received by the RC Server, the test results are displayed to the user.
- Same cycle is repeated instruction by instruction until entire test is completed.
Comparatively, WebDriver architecture is simpler than Selenium RC architecture as explained above. Selenium WebDriver architecture has the following two parts.
- Browser is controlled by WebDriver at Operating System (OS) level unlike RC Server.
- We require programming language’s IDE that has Selenium test commands and a web browser to run the website.
After discussing both the architectures, we can conclude that Selenium RC’s architecture is more complicated than Selenium WebDriver architecture.
Comparison between Selenium WebDriver and Selenium RC:
|S. No.||Factor||WebDriver||Selenium RC|
|3.||API Complexities||WebDriver API commands are very simple, non-redundant and easy to understand.||Selenium RC API is matured but has redundancies in commands which are sometimes very confusing while writing the test scripts. For example, testers are often getconfused withthe use type or typeKeys; and the use ofclick, mouseDown or mouseDownAt, etc.|
|5.||Programming Languages Support||It supports programming languages such as Java, .Net, PHP, Python, Perl and Ruby.||It also supports programming languages such as Java, .Net, PHP, Python, Perl and Ruby.|
|7.||Built-In Test Result Generator||WebDriver do not have any kind of built-in test result generator and for test results it relies on IDE’s output window.||Selenium RC has in-built test result generator that generates an HTML file of test results. RC has pre-set format for this file. This file helps RC to prepare the test results.|
In this chapter we have discussed about and Selenium WebDriver and RC architecture and later compared their utilities as an automated web testing tool.
If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below: