简体   繁体   中英

How to debug Firefox alert box closing automatically and being unable to detect the alert in Serenity BDD?

[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
}

Have you switched the driver on the alert box

driver.switchTo().alert();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM