288. WebDriver Interface and its Predefined Methods

'WebDriver' Interface is a predefined interface containing a lot of predefined methods to be used in Selenium WebDriver Automation.

In order to Access the predefined methods of 'WebDriver' interface, we've to create an object for the WebDriver interface and use the created object to retrieve the predefined methods of WebDriver interface.

We usually follow the below steps while writing Selenium WebDriver Automation Code:

1. Defining a WebDriver object as shown below:

2. Assign FirefoxDriver Class reference to the created object and call the 'FirefoxDriver( )' Constructor without parameters as shown below:

3. Retrieve the predefined methods of 'WebDriver' interface using the above defined and reference assigned object as shown below:

From the above steps its very clear that, we've retrieved the predefined method 'get( )' of 'WebDriver' interface using the object defined for 'WebDriver' interface i.e. _driver object.

But going forward, there are many predefined methods of 'WebDriver' interface like 'get( )' method. Each predefined method will perform a different kind of task for us.

Few Predefined Methods of WebDriver interface:

  get( ) -> Opens the specified URL is the browser
  click( ) -> Clicks the button or link in the browser
  quit( ) -> Closes the Browser

 And many more.

In the next posts, I'm going to explain some predefined methods that you may require often while writing Selenium WebDriver Automation code.To start with I will explain 'get( )' predefined method in the next post.

Please comment below to feedback or ask questions.

'get( )' WebDriver method will be explained in the next post.


Unknown said...

WebDriver is an Interface not a class. Please correct.

Arun Motoori said...

Written long back and is a mistake. Updated now, please check