Selenium - Web Driver Interview Questions

Selenium WebDriver
1. What is selenium webdriver?
2. How to write the tests in selenium webdriver?
3. How to configure selenium webdriver in eclipse?
4. What are the prerequisites to run selenium webdriver?
5. What is the difference between selenium 1.0 and webdriver?
6. What are the advantages of selenium webdriver?
7. What are the disadvantages of selenium webdriver over selenium 1.0?
8. How to handle multiple windows in selenium webdriver?
9. How to navigate with browser buttons in selenium webdriver?
10. Which are the locators used for recognizing the objects in selenium webdriver?
11. How to run the tests in internet explorer using selenium webdriver?
12. How to run the tests in firefox using selenium webdriver?
13. How to run the tests in google chrome using selenium webdriver?
14. How to run the tests without a browser or with HTML unit driver in selenium webdriver?
15. How to run Selenium 1.0 tests in webdriver?
16. How to convert selenium 1.0 tests to webdriver tests?
17. What is webdriver backed selenium?
18. When to use web driver backed selenium?
19. Which version of selenium IDE supports webdriver?
20. How to invoke an application in webdriver?
21. Which of Selenium IDE commands not supported in webdriver?
22. Where to download selenium webdriver?
23. What is implicit and explicit wait in selenium webdriver?
========================================================================
1: What is Selenium 2.0? I have heard this buzz word many times.
Answer: Selenium 2.0 is a consolidation of two web testing tools:
a) Selenium RC and
b) Web Driver,
It claims to give best of both words: Selenium and Web Driver.
2: Why are two tools being combined as Selenium 2.0?
Answer: Selenium 2.0 promises to give much cleaner API than Selenium RC and at the same time not being
restricted by JavaScript Security restriction like same origin policy.
3: So everyone is going to use Selenium 2.0?
Answer: Well no, for example if you are using Selenium Perl client driver than there is no similar offering
from Selenium 2.0 and you would have to stick to Selenium 1.0 till there is similar library available for
Selenium 2.0
4: So how do I specify my browser configurations with Selenium 2.0?
Answer: Selenium 2.0 offers following browser/mobile configuration:
a) Android Driver,
b) Chrome Driver,
c) EventFiringWebDriver,
d) Firefox Driver,
e) HtmlUnitDriver,
f) InternetExplorerDriver,
g) IPhoneDriver,
h) IPhoneSimulatorDriver,
i) RemoteWebDriver
Subbu
And all of them have been implemented from interface WebDriver.To be able to use any of these drivers,
you need to instantiate their corresponding classes.
5: How is Selenium 2.0 configuration different from Selenium 1.0?
Answer: In case of Selenium 1.0, you need Selenium jar file pertaining to one library; for example, in case of
Java you need Java client driver and also Selenium server jar file. With Selenium 2.0, you need language
Binding (i.e. Java, C#, etc) and Selenium server jar if you are using Remote Control or Remote Web Driver.
6. Selenium Benefits over Web Driver.
Selenium supports many browsers and many languages, Web Driver needs native implementations for each
new language/browser combo.
Very mature and complete API
Currently (Sept 2010) supports JavaScript alerts and confirms better
Benefits of Web Driver 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
7. What is Web Driver?
Web Driver uses a different underlying framework from Selenium’s javascript Selenium-Core. It also
provides an alternative API with functionality not supported in Selenium-RC. WebDriver does not depend on
a JavaScript core embedded within the browser; therefore it is able to avoid some long-running Selenium
limitations.
WebDriver’s goal is to provide an API that establishes
A well-designed standard programming interface for web-app testing.
• Improved consistency between browsers.
• Additional functionality addressing testing problems not well-supported in Selenium 1.0.
The Selenium developers strive to continuously improve Selenium. Integrating WebDriver is another step in
that process. The developers of Selenium and of WebDriver felt they could make significant gains for the
Open Source test automation community be combining forces and merging their ideas and technologies.
Integrating WebDriver into Selenium is the current result of those efforts.
8.When to Use WebDriver?
One should use WebDriver when requiring improved support for
* Mult-browser testing including improved functionality for browsers not well-supported by Selenium-1.0.
* Handling multiple frames, multiple browser windows, popups, and alerts.
* Page navigation.
* Drag-and-drop.
* AJAX-based UI elements.
Advantages of web driver compared to selenium.
1) Support for iPhone and Android testing
2) Implementation of listeners - a much awaited feature
3) Better features for Ajax testing.
4) You can easily simulate clicking on front and back button of browser.
5) You can extract objects in bulk like QTP. For ex - extract all links of page. With RC this was a big hastle
6) Unlike RC you don’t have to start a server in webdriver.
7) You can simulate movement of a mouse using selenium.
8) Tabs and pops are more or less the same. RC can also handle and Webdriver can also handle.
9) You can find coordinates of any object using Webdriver.
10) You have classes in Webdriver which help you to simulate key press events of keyboard.
10) Keyword driven framework is very easy to build in webdriver.
9.Which browsers does WebDriver support?
The existing drivers are the ChromeDriver, InternetExplorerDriver, FirefoxDriver, OperaDriver and
HtmlUnitDriver. For more information about each of these, including their relative strengths and weaknesses,
please follow the links to the relevant pages. There is also support for mobile testing via the AndroidDriver
and IPhoneDriver.