Webdriver is an interface which consists of abstract method that are needed to automate a web application. These abstract methods are implemented in corresponding browser classses.
If we want to work with Firefox browser, we have to make use of its corresponding class.
Note: We can’t create an object for interface.
We have to create an object of Firefox class. Upcast it to WebDriver. Using WebDriver you can use any programming language to create your test scripts. The programming languages which can be used for scripting using WebDriver are : Java, .Net, Python, Perl, Php, Ruby etc.
WebDriver Vs Selenium RC
- You can use programming language to design your test script in WebDriver and Selenium RC.
- You can run your test scripts on different browsers if you use WebDriver or Selenium RC.
- They both do not support Record and playback.
- In Selenium RC, you need to start the server before you execute your test script but in WebDriver there is no need to start the server before executing the test script.
- Selenium WebDriver, in comparison to Selenium RC is a bit complex.
- Moving mouse cursors are supported in WebDriver but not in Selenium RC.
- Implementation of listeners is supported in WebDriver but not in Selenium RC.
- In Selenium RC, you need to append the full xpath with “xpath=\\” but in WebDriver there is no need to append the full xpath.
- Selenium WebDriver’s architecture is not as complicated as of Selenium RC.
- Test Results are automatically generated in Selenium RC but in WebDriver there is not built-in Command to generate the results automatically.
- Selenium RC has the ability to support new browsers but Selenium WebDriver can not.