WebDriver Sample Code Explained

A simple WebDriver code explained below, helpful for absolute beginners.

Line 13: We create a new WebDriver object using Firefox as a browser. – Here we can use any of the WebDriver Implementation as mentioned above.

Line 17: The get method in WebDriver is the equivalent of Selenium.open() in Selenium 1.0

Line 21: We type in a search keyword in Google search box. SendKeys() is the equivalent of Selenium.type()/typeKeys()

Line 25: Clicking on the Search button to get the results based on search keyword

line 29: Clicking on the Link which will have the text “Selenium – Web Browser Automation

line 33: Extracting the text of the current browser window title.

Leave a Comment