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

不打扰是莪最后的温柔 提交于 2019-12-08 04:11:32

问题


[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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!