Quote

"Between stimulus and response there is a space. In that space is our power to choose our response.
In our response lies our growth and freedom"


“The only way to discover the limits of the possible is to go beyond them into the impossible.”


Monday 16 January 2012

Selenium WebDriver Interface

The interface WebDriver represents the main interface for testing a web browser instance. If you are using Selenium 2 then it is highly recommended to use the WebDriver instance because of the benefits suggested in my previous posts.
This interface provides most of the basic requirements for testing a web application. Normally the testing of a web application requires either one or all of the following three functions:

· Controling the browser
· Selection of WebElement
· Debugging aids

The methods in this class provide solutions to the requirements in all the three categories mentioned above:
· Control of the browser:
    • get(): Loads the web page rendered by the URL string passed to this method. Similar results can be obtained by using WebDriver.Navigation.to(String)
    • navigate():Loads the web page rendered by the URL and access browser history
    • close(): Closes the ‘Current’ browser window
    • quite(): Closes ‘All’ browser windows associated with the webDriver instance
    • switchTo(): Changes current window and redirects all commands to the new ‘current’ window (example: switchTo().window(String))
    • manage(): Enables access to browser menu items, such as add cookies, logs etc
· Selection of WebElement:
    • findElement(): Returns the first ‘Webelement’ found
    • findElements(): Returns all the ‘WebElements’ found in the current web page
· Debugging aids:
    • getCurrentUrl(): Returns the current URL loaded in the browser session
    • getPageSource(): Returns HTML source of the current page loaded in the browser
    • getTitle(): Returns the title of current page
    • getWindowHandle(): Return unique string identifier of the current window in the driver instance
    • getWindowHandles(): Return identifiers of all the windows in the driver instance

1 comment: