ERROR net.serenitybdd.core.Serenity - No alert is present (WARNING: The server did not provide any stacktrace information)
I get this erro
You might need to add code to wait for the alert to be visible. Selenium can't tell if JavaScript has finished executing.
waitForAlert(WebDriver driver)
{
int i=0;
while(i++<5)
{
try
{
Alert alert = driver.switchTo().alert();
break;
}
catch(NoAlertPresentException e)
{
Thread.sleep(1000);
continue;
}
}
}
A little more elegant solution :
WebDriverWait wait = new WebDriverWait(driver, timeout);
wait.until(ExpectedConditions.alertIsPresent());
Use the WebDriverWait, every time you have dynamic element that are not present when the page is done loading, like alert, popupwindow, modal popup, hiden element which turn visible,.