Code to Verify an element present or not in Webdriver
This program will return true if element is present else it will return false
public boolean verifyElementPresent(WebDriver driver,String locatorxpath)
{
boolean flag=false;
try
{
driver.findElement(By.xpath(locatorxpath));
flag=true;
}
catch(Exception ex)
{
flag=false;
}
return flag;
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment