Why WebDriver is needed when selenium already exists?
As Selenium is written in JavaScript which causes a significant weakness.
Browsers impose a pretty strict security model on any JavaScript that they execute in order to protect a user from malicious scripts. Example is IE prevents JavaScript from changing the value of an INPUT file element
Also, the API for Selenium RC has grown over time, so it has become harder to understand how best to use it.
Because of above situation,WebDriver was introduced.
WebDriver takes a different approach to solve the same problem as Selenium.
Instead of using JavaScript application running within the browser, it uses whichever mechanism is most appropriate to control the browser.
By changing the mechanism used to control the browser, we can circumvent the restrictions placed on the browser by the JavaScript security model.
By changing the mechanism used to control the browser, we can circumvent the restrictions placed on the browser by the JavaScript security model.
In those cases where automation through the browser isn't enough, WebDriver can make use of facilities offered by the Operating System.
Capabilities of Selenium and WebDriver
Capabilities of Selenium and WebDriver
Feature
|
Selenium
|
WebDriver
|
Real browsers
|
Always requires a real browser
|
Make use of an implementation
based on HtmlUnit which provides
lightweight, super-fast browser emulation
|
Support for common situations
|
For many of the common situations
you might want to test |
Ability to step outside the
JavaScript sandbox which opens
up some interesting possibilities |
Supporting browsers
|
Can easily be extended
|
Requires lot of work from frame
work developers
|
The above capabilities explain the merging of two Selenium and WebDriver,to form Selenium 2.0 will offer WebDriver's API alongside the traditional Selenium API and merging the two implementations to offer a capable, flexible testing framework.
One of the benefits of this approach is that there will be an implementation of WebDriver's cleaner APIs backed by the existing Selenium implementation.
Although this won't solve the underlying limitations of Selenium's current JavaScript-based approach, it does mean that it becomes easier to test against a broader range of browsers. And the reverse is true; we'll also be emulating the existing Selenium APIs with WebDriver too. This means that teams can make the move to WebDriver's API (and Selenium 2) in a managed and considered way.
WebDriver follows a Object-based API
Selenium's is a dictionary-based approach.
The above contents are taken from this sites
1. http://google-opensource.blogspot.com/2009/05/introducing-webdriver.html
Comments