Selenium WebDriver Commands

Selenium WebDriver Commands:

As we learn previously in the Selenium-IDE tutorial, Selenium commands are the set of commands that are used to run a Selenium test script.

But whereas, Selenium WebDriver had a different set of commands to perform various actions.

As we are using Selenium WebDriver with Java, all the commands written in simple methods.

Note: A method is a collection of statements that perform some specific task without returning anything.

Before getting into the details of browser controls of Selenium WebDriver, we will recommend you to go through the Java programming OOPs (Object-Oriented Programming) concepts.

For a better understanding of the topic, you can also refer to the given link:

Now, we will learn that how we can use methods of the WebDriver-

To see the methods of selenium WebDriver , firstly open the Eclipse IDE where we have a jar files of the selenium web driver.

After that, we create a driver object of web driver for any browser and type driver. 

And it will display all available methods in the web driver.

//create the chrome driver class

WebDriver driver=new ChromeDriver();

Selenium Web Driver Commands

Let us see an example form the below snapshot taken from Eclipse where

 example form the below snapshot taken

Method Name:

The Method name is used to access the method of any class, we need to create an object of a class, and then all the public methods will appear for the object.


It is an argument that is used to perform a specific operation with the help of a method.

Return type

Return type defines the data type of a value return from the method.

If the void comes after the method, which means the function is returning no value.

Or, if it is returning a value, then the value will be displayed, e.g., getPageSource(): String.

Now, let us discuss the various controls command used in Selenium WebDriver.

The WebDriver r commands can be divided into the following parts i.e.

Selenium Web Driver Commands
  • Browser Controls
  • Navigation Controls
  • Web Element Controls