Selenium Webdriver Commands

Selenium Webdriver Commands

There are many selenium webdriver commands use to automate a project as we have seen in my previous posts of selenium webdriver. Some of the available commands in webdriver are Browser Commands, Interactive Commands, Information Commands, String Comparison Commands, Validation Commands etc.

Browser Commands:

The browser commands use to open the browser, close the browser and open the website by get the url.

get :- It is to open the URL of the web application.

    Syntax: driver.get(“url”);

quit():- It is to close the browser.

    Syntax: driver.quit();

close:- It is to close the child or pop up window.

Syntax: driver.close();


Interactive Commands:

The interactive commands use to interact with the web application like, enter values in the textbox, clear the values from the text box, click any button, check box or radio button, select the values from the dropdown.

sendkeys:- It is to enter some value in the text box.

Syntax: driver. findelement ( (“username”)). sendkeys(“name1”);

clear:- It is to clear the data from the text box.

Syntax: driver. findelement ( (“username”)). clear();

click:- By using this command we can clink on a button, radio button, checkbox, image and link.

Syntax: driver. findelement ( (“button1”)). click();

newSelect:- It is to select a value from a dropdown and a list box.

Syntax: new Select(driver.findElement(“continents”))).selectByVisibleText(“Australia”);


Information Commands:

The information commands use to extract the information within the tags, outside the tags or dropdowns etc. from the applications.

getText():- It is to take the information from the application which is available outside of the tags.

getAttribute():- It is to take the information from the application which is available in between the tags.

getOptions():-It is to take the information from the application which is available within a dropdown and a list box.


String Comparison Commands:

We can compare the strings with another string by using the below commands.

equals:- It is to compare the string with another object where it is case sensitive.

equalsIgnoreCase:- It is also to compare with another string but it is not case sensitive.

Contains:- It is to check that whether the sequence of characters are available in string or not.


Validation Commands:

The validation commands use to validate the element availability, enable, disable and select the check boxes etc.

isDisplayed():- It is to check whether the element is available or not.

isEnabled():- It is to check whether the element is enabled or disabled.

isSelected():- It is to validate whether the radio button or check box is selected or not.


Please click here to read Automation Script Implementation

8 Thoughts on Selenium Webdriver Commands

  1. WebDriver is an extended version to Selenium RC with surplus advantages and it overcomes many of its limitations. Selenium WebDriver permits you to run your tests against diverse browsers, not just Firefox WebDriver also enables you to use a programming language in creating your test Following programming languages are supported by WebDriver are Java, .Net, PHP, Python, Perl, Ruby.

    Well thanks for sharing these helpful commands!

Leave a Comment