如何调试Firefox警报框自动关闭并且无法检测Serenity BDD中的警报?

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

我的问题与这个“ 用Selenium WebDriver未检测到的Firefox警报框 ”完全相似

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

执行此任务时,当我单击“更新”按钮并且工作正常时,会弹出手动弹出窗口。

但是,当我使用自动弹出显示执行相同操作并立即在几分之一秒内自动关闭时,平静会抛出无警报未找到的错误。 此外,自动化期间出现的警报窗口与手动执行期间发现的警报窗口略有不同。 如果您想在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 } 

你有没有在警报框上切换驱动程序

driver.switchTo()警报();