What is Selenium WebDriver?
WebDriver is developed to overcome the limitations in the Selenium-RC API. Selenium WebDriver is a cross-platform testing framework that allows you to execute your tests against different browsers like Mozilla Firefox, Google Chrome, InternetExplorer, Safari, Opera, GhostDriver, etc. It is a programming interface to create and run test cases. It does not require a core engine like Selenium RC and interacts natively with the browser applications. Selenium WebDriver speaks directly to the browser using browser drivers for a particular browser.
Selenium WebDriver supports the following languages
- Java
- Python
- C#
- Ruby
- Perl
- PHP
Difference between Selenium RC and WebDriver
            Selenium RC |           Selenium WebDriver |
Selenium RC is a Weak API | WebDriver is a Strong API |
Management of excessive test suites is a problem | Management of excessive test suites is a cakewalk |
No support for third-party API and software | Supports third party API and Software |
Need to start RC Server | No need to start any server |
Uses command line prompt | No usage of command-line prompt |
Bad report generation | Can generate the technical and managerial report |
Cannot run Selenium WebDriver script | Can run Selenium RC scripts |
Misfires RC server most of the times | No server, no miss-firing |
Command specific usage | No command used |
Let us discuss how Selenium RC and WebDriver differ each other
1. Architecture
Selenium WebDriver’s architecture is simple than Selenium RC’s.
- It controls the browser from Operating System-level
- All you need are your programming languages IDE and a browser
Selenium RC’s architecture is more complicated than WebDriver
- You first need to install and launch a separate application called Selenium Remote Control Server before you start running test scripts
- The Selenium RC Server acts as a mediator between your browser and your Selenium commands
The following operations are performed behind the scenes when you run your tests scripts in Selenium RC:
- The Selenium RC Server injects a Javascript Program called Selenium Core into the browser
- Once the Selenium Core is injected it will start receiving instructions from the RC server based on test scripts
- Once the instructions are received, Selenium Core executes all these as Javascript commands.
- The web browser will execute all the commands of Selenium Core and returns its response to the RC Server.
- The RC Server will receive the browser response and then display the results.
2. Speed
Selenium WebDriver scripts execution is faster than Selenium RC since it speaks directly to the browser using browser drivers for a particular browser.
Selenium RC scripts execution is slower than Selenium WebDriver since it uses a Javascript program called Selenium Core. This Selenium Core directly controls the browser.
3. Real-life Interaction
Selenium WebDriver communicates with elements the page in a more realistic way. For example, if you have disabled dropdown on a webpage you are testing, WebDriver cannot select any value in it just like how a real person can’t do.
Just like other JavaScript codes, Selenium RC can access disabled elements.
4. Object-Oriented
Selenium RC is less object-oriented API, whereas Selenium WebDriver is purely object-oriented API. Selenium WebDriver is purely based on object-oriented programming languages like C#, Java, Python, etc. Selenium RC has weak API, whereas WebDriver has Strong API.
5. Browser Support
Selenium WebDriver can support a headless HTMLUnit browser. The term Headless refers to an invisible browser written in java. It can be configured to simulate a specific browser. It is a very fast browser because of no need to wait till the time in waiting for page elements to get loaded.Â
Selenium RC cannot support the headless HtmlUnit browser. To operate it needs a real, visible browser.
Advantages of Selenium WebDriver over Selenium RC
Selenium WebDriver | Selenium RC |
Simple Architecture | Complex Architecture |
Selenium WebDriver is faster because it interacts directly with the browser | Selenium RC is slower since it uses a Javascript program called SeleniumCore |
Support for HTMLUnit browser | No supports HTMLUnit browser |
WebDriver directly interacts with the user | Acts as a middleman between browser and user |
Limitations of WebDriver
- Selenium doesn’t support Windows based applications.Â
- By alone Selenium tool cannot test mobile applications, we can achieve it with the help of Appium.
- By alone Selenium tool cannot test Windows-based popup, we need to use AutoIT tool to handle the windows based popups
- Selenium uses JUnit/ TestNG for reporting since selenium doesn’t have inbuilt reporting capability.
- Selenium doesn’t have an in-built object repository.
- No reliable support is available because of an open-source.
- Selenium doesn’t support to perform testing on images, we need to use Sikuli for image-based testing.
Selenium RC has In-built Test Result Generator
Selenium RC mechanically generates an HTML file to test results. RC by itself sets the report format.
Selenium WebDriver has no in-built command to generate a Test Results File automatically. You have to depend on your IDE’s output window or you need to design the report by yourself by using the programming language capabilities.
Conclusion
- Due to simpler architecture, Selenium WebDriver is faster than Selenium RC
- Selenium RC cannot support HtmlUnit browser like WebDriver
- Selenium RC takes the help of RC Server to talks to the browser, where WebDriver talks to the browser directly.
- WebDriver is a tool used for testing web-based applications across multiple browsers with different programming languages.
- Selenium WebDriver’s API is briefer than Selenium RC’s.
- WebDriver cannot readily support new browsers like Selenium RC.
- WebDriver does not have an in-built command for automatic test results generation.
Note: The Selenium RC is in no way used in the current market, it is completely deprecated.
Â
Â
5 Responses