【问题标题】:How to automatically handle alerts with Splinter in Python如何在 Python 中使用 Splinter 自动处理警报
【发布时间】:2014-12-10 02:34:11
【问题描述】:

我正在使用 Selenium 的 Python 包装器 Splinter 在在线商店购物。浏览器随机抛出 UnexpectedAlertPresentException。我不知道在我的过程中会在哪里抛出这个错误,检查这个警报并一直关闭它似乎很荒谬。有没有办法让司机自动解除警报?

【问题讨论】:

    标签: javascript python selenium splinter


    【解决方案1】:

    您可以使用 browser.execute_script 覆盖 window.alert 方法。参见例如。 http://itreallymatters.net/post/1482786902/testing-webpages-with-javascript-popups-correctly#.VUvFhNS1Gko

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-03
      • 2022-09-23
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 2016-04-10
      • 2014-08-29
      相关资源
      最近更新 更多