What is Selenium WebDriver? Difference with RC
Introduction about WebDriver?
WebDriver:- Selenium WebDriver is a web automation framework and it is collection of open source APIs. It helps to execute ours tests on different web browsers like Chrome, IE, Firefox and Safari(not possible in Selenium IDE).
- WebDriver supports following programming languages:-
We just need to know one of the above given languages and in this session we will use Java languages with Eclips as our IDE.
What is difference between Selenium RC and Webdriver
Before Coming WebDriver(2006) we had another automation tool called Selenium Remote Control(Selenium RC).
WebDriver and Selenium Remote Control(Selenium RC) have some following common features:-For your test scripts designing both are allow to use programming language.Both are support different browsers for testing script.
Let us see how do they differ? .
WebDriver’s architecture is simple than Selenium RC’s.
- It eccess the browser from the OS level
- We need our programming language’s IDE and a browser.
Selenium RC’s architecture is more complicated than WebDriver.
- For Selenium RC we need to first launch a separate application i.e Selenium Remote Control (RC) Server before start testing
- Selenium RC Server acts as a “mediator” between our Selenium commands and browser
- Once inserted, Selenium Core start to received instructions send by the RC Server from our test program.
- The browser will accept the instructions of Selenium Core and will send this response to the RC Server.
- The Selenium Remote Control Server will receive browser’s response and then it display the results for us.
- RC Server will retrieve the next instruction from our test script to repeat the whole cycle.
Selenium WebDriver is more faster than Selenium RC since it communicate directly to the browser and browser use own engine to control it.
3. Real-life Interaction
WebDriver interacts with page elements in a more realistic way. For example, if you have a disabled text box on a page you were testing, WebDriver really cannot enter any value in it just as how a real person cannot.
Selenium RC’s API is more matured but contains redundancies and often confusing commands. For example, most of the time, testers are confused whether to use type or typeKeys; or whether to use click, mouseDown, or mouseDownAt. Worse, different browsers interpret each of these commands in different ways too!
WebDriver’s API is simpler than Selenium RC’s. It does not contain redundant and confusing commands.
5. Browser Support
WebDriver can support the headless HtmlUnit browser
HtmlUnit is termed as “headless” because it is an invisible browser – it is GUI-less.
It is a very fast browser because no time is spent in waiting for page elements to load. This accelerates your test execution cycles.
Since it is invisible to the user, it can only be controlled through automated means.
Selenium RC cannot support the headless HtmlUnit browser. It needs a real, visible browser to operate on.
Limitations of WebDriver
WebDriver Cannot Readily Support New Browsers
Remember that WebDriver operates on the OS level. Also, remember that different browsers communicate with the OS in different ways. If a new browser comes out, it may have a different process of communicating with the OS as compared to other browsers. So, you have to give the WebDriver team quite some time to figure that new process out before they can implement it on the next WebDriver release.
However, it is up to the WebDriver’s team of developers to decide if they should support the new browser or not.
Selenium RC Has Built-In Test Result Generator
Selenium RC automatically generates an HTML file of test results. The format of the report was pre-set by RC itself. Take a look at an example of this report below. WebDriver has no built-in command that automatically generates a Test Results File. You would have to rely on your IDE’s output window, or design the report yourself using the capabilities of your programming language and store it as text, HTML, etc.
- WebDriver is a tool for testing web applications across different browsers using different programming languages.
- You are now able to make powerful tests because WebDriver allows you to use a programming language of your choice in designing your tests.
- WebDriver is faster than Selenium RC because of its simpler architecture.
- WebDriver directly talks to the browser while Selenium RC needs the help of the RC Server in order to do so.
- WebDriver’s API is more concise than Selenium RC’s.
- WebDriver can support Html Unit while Selenium RC cannot.
- The only drawbacks of WebDriver are:
It cannot readily support new browsers, but Selenium RC can. It does not have a built-in command for automatic generation of test results.