public boolean isDisplayedScreen(String screenName, int waitSeconds) throws InterruptedException {
boolean isDisplayed = false;
if (screenName !=null && !screenName.isEmpty()) {
for (int i = 0; i < waitSeconds; i++) {
Thread.sleep(1000);
if (driver instanceof AndroidDriver &&
((AndroidDriver) driver).currentActivity().equalsIgnoreCase(screenName)) {
isDisplayed = true;
break;
}
}
}
return isDisplayed;
}