public boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } // try catch (NoAlertPresentException Ex) { return false; } // catch}
if(isAlertPresent()){ driver.switchTo().alert().accept(); }
No comments:
Post a Comment