public boolean isDisplayed(WebElement element) {
try {
return element.isDisplayed();
} catch (NoSuchElementException e) {
return false;
}
}
If you wan t to check that element is displayed on the page your check should be:
if(isDisplayed(yourElement){
...
}
else{
...
}