Wednesday, October 15, 2014

15 Most Commonly Used Selenium WebDriver Command’s in 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.(""));

No comments:

Post a Comment