Can anyone help me in understanding the difference between Selenium RC and WebDriver and which one is better and why?
-
Possible duplicate of [this question](http://stackoverflow.com/questions/3619824/whats-the-relationship-between-selenium-rc-and-webdriver). – shamp00 Dec 19 '11 at 11:27
2 Answers
Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to support Ajax and other heavily dynamic pages. However, this also means Selenium runs inside the JavaScript sandbox. This means you need to run the Selenium-RC server to get around the same-origin policy, which can sometimes cause issues with browser setup.
WebDriver on the other hand uses native automation from each language. While this means it takes longer to support new browsers/languages, it does offer a much closer ‘feel’ to the browser. If you’re happy with WebDriver, stick with it, it’s the future. There are limitations and bugs right now, but if they’re not stopping you, go for it.
Selenium Benefits over WebDriver
- Supports many browsers and many languages, WebDriver needs native implementations for each new languagte/browser combo.
- Very mature and complete API
- Currently (Sept 2010) supports JavaScript alerts and confirms better
Benefits of WebDriver Compared to Selenium
- Native automation faster and a little less prone to error and browser configuration
- Does not Requires Selenium-RC Server to be running
- Access to headlessHTMLUnit can allow really fast tests
- Great API

- 4,202
- 12
- 55
- 77
It's explained here.
Selenium-RC uses JavaScript to automate web pages. Therefore it is constrained by what you can do with JavaScript, specifically, it is constrained to the JavaScript sandbox. It also requires the Selenium-RC server. It supports many browsers and many languages.
WebDriver uses native automation and does not have the sandbox constraints of Selenium-RC. It's a little faster and does not require a server.

- 11,106
- 4
- 38
- 81
-
thank you ...but if it is the case then why is it recommended to move to Web Driver and not continuing with Selenium RC – user1100199 Dec 19 '11 at 13:40
-
In addition to obviating the need for Selenium server, WebDriver addresses a number of limitations of Selenium RC along with an alternative, and simpler, programming interface. It provides support for a larger number of browsers. It is often tricky to get Selenium RC to work well with modern websites with AJAX, jQuery, etc. WebDriver is more likely to be able to deal with these. – shamp00 Dec 19 '11 at 14:51