288. WebDriver Class and its Predefined Methods

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

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

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' class 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' Class using the object defined for 'WebDriver' Class i.e. _driver object.

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

Few Predefined Methods of WebDriver Class:

  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.

No comments:

Followers :)

Blog Index