What's new? | Help | Directory | Sign in
Google
webdriver
A developer focused tool for automated testing of webapps
  
  
  
  
    
Search
for
Updated Jul 04 (4 days ago) by simon.m.stewart
Labels: Featured
FrequentlyAskedQuestions  
WebDriver FAQs

FAQ

Q: What is WebDriver?

A: WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application.

Q: So, is it like Selenium? Or Sahi?

A: The aim is the same (to allow you to test your webapp), but the implementation is different. Rather than running as a Javascript application within the browser (with the limitations this brings, such as the "same origin" problem), WebDriver controls the browser itself. This means that it can take advantage of any facilities offered by the native platform.

Q: What is Selenium 2.0?

A: WebDriver will soon become part of Selenium. The main contribution that WebDriver will make is its API and the native drivers. The process of rolling WebDriver into Selenium will probably take some time, so until it's complete if you'd like to use the WebDriver API then the best bet will be to use WebDriver directly.

Q: What does it mean to be "developer focused"?

A: We believe that within a software application's development team, the people who are best placed to build the tools that everyone else can use are the developers. Although it should be easy to use WebDriver directly, it should also be easy to use it as a building block for more sophisticated tools. Because of this, WebDriver has a small API that's easy to explore by hitting the "autocomplete" button in your favourite IDE, and aims to work consistently no matter which browser implementation you use.

Q: How do I execute Javascript directly?

A: We believe that most of the time there is a requirement to execute Javascript there is a failing in the tool being used: it hasn't emitted the correct events, has not interacted with a page correctly, or has failed to react when an XmlHttpRequest returns. We would rather fix WebDriver to work consistently and correctly than rely on testers working out which Javascript method to call.

We also realise that there will be times when this is a limitation. As a result, for those browsers that support it, you can execute Javascript by casting the WebDriver instance to a JavascriptExecutor. In Java, this looks like:

WebDriver driver; // Assigned elsewhere
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return document.title");

Other language bindings will follow a similar approach.

Q: Which browsers does WebDriver support?

A: The existing drivers are the InternetExplorerDriver, FirefoxDriver, SafariDriver and HtmlUnitDriver. For more information about each of these, including their relative strengths and weaknesses, please follow the links to the relevant pages.

Q: HtmlUnit Supports Javascript So Why Doesn't the HtmlUnitDriver?

A: Please see the HtmlUnitDriver page for more details, but the short answer is because no browser uses the JS engine used by HtmlUnit.

Q: My XPath finds elements in one browser, but not in others. Why is this?

A: The short answer is that each supported browser handles XPath slightly differently, and you're probably running into one of these differences. The long answer is on the XpathInWebDriver page.

Q: The InternetExplorerDriver does not work well on Vista. How do I get it to work as expected?

A: There are a number of solutions:

Q: What about support for languages other than Java?

A: Support for other languages is planned, and we will be announcing these on the mailing list as they are checked in.

Q: I'd like it if WebDriver did....

A: If there's something that you'd like WebDriver to do, or you've found a bug, then please add an add an issue to the WebDriver project page.


Comment by jdbeutel, Feb 19, 2008

Is it like JWebUnit?

Comment by jingweisun, Apr 29, 2008

please give me a reason why I should migrate from selenium to webdriver?

Comment by simon.m.stewart, Jul 04 (4 days ago)

@jingweisun: There are a number of reasons why you may want to make the migration. Firsly, WebDriver? requires no external process in order to run: just drop the JARs into your project and start using it. Secondly, the API presented by WebDriver? is clean and relatively simple. Finally, WebDriver? works by controlling the browser natively, meaning that some tasks which are difficult or problematic in Selenium are simpler, such as working across many domains and HTTPS.

I should point out that the WebDriver? and Selenium projects will be merging. Please see the FAQ about this :)


Sign in to add a comment