selenium-webdriver-commands
 Rating: 1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

15 Most Commonly Used Selenium WebDriver Command’s in Java



Selenium 2.0 also known as WebDriver is the best automation tool for web and offers very user friendly learning and impressive work. WebDriver has covered all the limitation of Selenium RC and work on a standalone server. Here is the basic and most commonly used functions of  WebDriver with Java.

Popup Windows and Frames

Popup window handling is one of the must handle things in Automation and Webdriver does is really well. Using the window handle command.

Once action is performed, switch back to parent window.

List Box

Select an item in Listbox using Selenium Webdriver is quite easy, there two way’s to do it.

Or

Then

Right Click

Excel Reader

Read or write data from excel using the jxl or POI, I will prefer POI. Create a property reader file then read the data

Database Connection

To connect to Database using WebDriver with Java, we use DBC(“Java Database Connectivity) API.

Time Outs – Wait

Implicit Waits:

Or

Explicit Waits

alert.accept(); or alert.dismiss();

Navigation

Table Columns

Drag And Drop

Mouse Over

IsElement/TextPresent

There are various way to check weather an element is present of not before execution of a piece of code.

Option 1

Option 2

Option 3

Sweet and simple one line of code

Web Elements Finding

These are generic ways to do certain common task i.e.

Id: WebElement element = driver.findElement(By.id(""));

Name: WebElement element = driver.findElement(By.name(""));

Tag Name: WebElement frame = driver.findElement(By.tagName("iframe"));

Xpath: WebElement element = driver.findElement(By.xpath.name(""));

CSS: WebElement element = driver.findElement(By.CSS.name(""));

LinkText: WebElement element = driver.findElement(By.LinkText.(""));

I hope these commands will let you work with Selenium WebDriver like a star. Please leave us a comment and share your own experiences, commands with us.

Related Posts

site-for-free

A Guide to Building a Great Looking Site for Free

java

10 Must Know Java Programs for Intermediate Developers