如何调试Firefox警报框自动关闭并且无法检测Serenity BDD中的警报? [英] How to debug Firefox alert box closing automatically and being unable to detect the alert in Serenity BDD?

查看:328
本文介绍了如何调试Firefox警报框自动关闭并且无法检测Serenity BDD中的警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


[main] ERROR net.serenitybdd.core.Serenity - 不存在警报
(警告:服务器未提供任何堆栈跟踪信息)

[main] ERROR net.serenitybdd.core.Serenity - No alert is present (WARNING: The server did not provide any stacktrace information)

我的问题与此问题完全相似使用Selenium WebDriver未检测到Firefox警报框

My question is exactly similar to this one "Firefox alert box not detected with Selenium WebDriver"

但我无法找到解决方案。即使我已经尝试了所有类型的等待,更改了Firefox版本并尝试了共享链接中提到的解决方案。但是,要么我无法实现它,要么它无法正常工作。

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.

但是,当我使用自动弹出显示执行相同操作时,会立即在几秒钟内自动关闭,并且平静会抛出无警报未找到的错误。此外,自动化期间出现的警报窗口与手动执行期间发现的警报窗口略有不同。如果你想看到windows中的差异,请参阅上面分享的链接。

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();

driver.switchTo().alert();

这篇关于如何调试Firefox警报框自动关闭并且无法检测Serenity BDD中的警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆