Thursday, March 22, 2012

Webdriver - Element Exist

Webdriver - Element Exist

I use following code to check whether an element exist.
.size() will provide the total number of elements. Make sure that your id or xPath will return the size as 1.

     if((driver.findElements("ctl00_cpheRFx_dgSuppliers_ctl0_lnkCompanyName")).size())== 1){
    else {
    fail("Supplier Not Added Successfully");
    Print("Supplier Not Added Successfully");


No comments:

Post a Comment