【问题标题】:How to click on JavaScript Alert on top of the browser如何点击浏览器顶部的 JavaScript 警报
【发布时间】:2018-03-07 16:01:45
【问题描述】:
WebDriverWait wait = new WebDriverWait(driver, 3000);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = webDriver.switchTo().alert();
alert.accept();

点击please update flashplayer链接后,警报会打开,但代码无法点击允许按钮。我收到错误。 org.openqa.selenium.NoAlertPresentException:没有打开警报

截图附在这里Allow Flash

【问题讨论】:

  • 这不是 Javascript 警报。这是浏览器警报,我怀疑你可以用 Selenium 处理它

标签: javascript java selenium selenium-chromedriver


【解决方案1】:

您不能点击浏览器提示,但您可以启用 flash 以使提示永远不会出现。不是我以前做过的事情,但希望这个链接能给你带来正确的方向。

https://sqa.stackexchange.com/questions/30312/enable-flash-player-on-chrome-62-while-running-selenium-test

祝你好运!

【讨论】:

    猜你喜欢
    • 2022-11-04
    • 1970-01-01
    • 2022-07-20
    • 2023-02-05
    • 1970-01-01
    • 2016-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多