We have IsDisplayed()
method created in our framework at lib
class:
public static boolean isDisplayed()(WebElement locator){
try{
return locator.isDisplayed();
}catch (Exception e){
return false;
}
}
This is the WebElement:
public WebElement icon(String rootnumber){
WebElement e=driver.findElement.(By.xpath("//div[@row_id='"+rootnumber+"']//following-sibling::span[@matbadgecolor='warn']"));
return e;
}
So inside a method, I tried to print boolean value of icon like this:
System.out.println("Boolean value of icon presence is "+lib.isDisplayed(icon("123456789")));
It gives me NoSuchElementException
error at this sysout
command instead of printing boolean value.