问题
[main] ERROR net.serenitybdd.core.Serenity - No alert is present (WARNING: The server did not provide any stacktrace information)
My question is exactly similar to this one "Firefox alert box not detected with Selenium WebDriver"
But I am not able to find the solution. Even I have tried all kind of waits, changed Firefox versions and tried the solution mentioned in the shared link. But, either I am not able to implement it or its not working.
When doing this task manually pop up comes up when I click on update button and it's working fine.
But, when I do same action using automation pop-up shows and immediately closes automatically within a fraction of seconds and serenity throws error that No Alert not found. Also, alert window that appears during automation is bit different than the one found during manual execution. Please, refer to the link shared above if you want to see the difference in windows.
public void i_click_update_button() throws InterruptedException {
btn_update.waitUntilClickable().click(); // clicks the button & pop-up comes
}
public void Accept_POP_UP() throws InterruptedException {
getAlert().accept(); // code to accept the alret. I have already tried implementing wait & everything. problem is pop-up comes & immediately closes automatically
}
回答1:
Have you switched the driver on the alert box
driver.switchTo().alert();
来源:https://stackoverflow.com/questions/40989047/how-to-debug-firefox-alert-box-closing-automatically-and-being-unable-to-detect