Back
I want to check the existence of an alert in WebDriver.
Sometimes it pops and will not pop up sometimes. I want to check if the alert exists first and proceed
The following code allows you to determine if there is an alert without exceptions and without creating the WebDriverWait object.
boolean isDialogPresent(WebDriver driver) { IAlert alert = ExpectedConditions.AlertIsPresent().Invoke(driver); return (alert != null);}
boolean isDialogPresent(WebDriver driver) {
IAlert alert = ExpectedConditions.AlertIsPresent().Invoke(driver);
return (alert != null);
}
Want to learn Selenium, check out our Selenium training.
Learn Selenium automation testing with our comprehensive Selenium Tutorial and ace your next job interview with our Selenium Interview Questions!
1.2k questions
2.7k answers
501 comments
693 users