gpt4 book ai didi

java - 如何调试 Firefox 警报框自动关闭且无法在 Serenity BDD 中检测到警报?

转载 作者:太空宇宙 更新时间:2023-11-04 12:00:09 25 4
gpt4 key购买 nike

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

我的问题与这个“Firefox alert box not detected with Selenium WebDriver”完全相同

但是我找不到解决方案。即使我已经尝试了各种等待,更改了 Firefox 版本并尝试了共享链接中提到的解决方案。但是,要么我无法实现它,要么它不起作用。

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

但是,当我使用自动化弹出窗口执行相同的操作时,弹出窗口显示并在几秒钟内立即自动关闭,并且 Restful 会抛出“未找到警报”的错误。此外,自动化期间出现的警报窗口与手动执行期间出现的警报窗口略有不同。如果您想了解 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().alert();

关于java - 如何调试 Firefox 警报框自动关闭且无法在 Serenity BDD 中检测到警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40989047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com