Thursday, March 18, 2010

WebDriver in Selenium2.0 FAQ in short

Usually ,I always take look at FAQ to see if this tool did have what i need and its pros/cons:

Q: Why WebDriver:
A: WebDriver is becoming part of Selenium2.0.The main contribution that WebDriver will make is its API and the native drivers(which means WebDriver controls the browser itself).

Q: How do I handle pop up windows?

A: WebDriver offers the ability to cope with multiple windows. This is done by using the "WebDriver.switchTo().window()" method to switch to a window with a known name. If the name is not known, you can use "WebDriver.getWindowHandles()" to obtain a list of known windows. You may pass the handle to "switchTo().window()".

Q: WebDriver fails to find elements / Does not block on page loads
A: Solution: Use the Wait class to wait for a specific element to appear. This class simply calls findElement over and over, discarding the NoSuchElementException each time, until the element is found (or a timeout has expired). Since this is the behaviour desired by default for many users, we're working on implicitly-waiting classes

Q: Why is it not possible to interact with hidden elements?

Since a user cannot read text in a hidden element, WebDriver will not allow access to it as well.
However, it is possible to use Javascript execution abilities to call getText directly from the element: ((JavascriptExecutor) driver).executeScript("return arguments0.getText();", ...)

Run some smoke cases in Netbeans IDE, it is cool till now. But I am a Watir fan for quite a while:)

No comments:

Post a Comment