I'm automating this site as a practice https://www.demoblaze.com/index.html, after completing sign up modal and click Sign Up button, another pop up is raised to confirm the sign up process.
If I don't catch the alert modal I get "org.openqa.selenium.UnhandledAlertException: unexpected alert open: {Alert text : Sign up successful.}"
but if I handle the alert like this:
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
try {
driver.switchTo().alert().accept();
}
catch (NoAlertPresentException Ex) {
System.out.println("no hay alerta");
}
I get "org.openqa.selenium.NoAlertPresentException: no such alert" When I debugged the test, it skips the try/catch sentence.
I also see that I cannot inspect with Chrome browser dev tools or Xpath Helper.