【问题标题】:how to close dialog box by Esc and reopen it again in selenium如何通过 Esc 关闭对话框并在 selenium 中再次打开它
【发布时间】:2013-07-12 22:31:38
【问题描述】:

堆栈跟踪

  org.openqa.selenium.UnhandledAlertException: Modal dialog present

构建信息:版本:'2.25.0',修订:'17482',时间:'2012-07-18 22:18:01' 系统信息:os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.6.0_22' 驱动程序信息:driver.version:RemoteWebDriver 会话 ID:a2e9f47e-c4f9-4814-bd16-c12a028cf38e

【问题讨论】:

    标签: selenium automation qa


    【解决方案1】:

    我已经在 ruby​​ 中尝试过这个,希望它有所帮助:)

    出现对话框后粘贴以下关闭对话框

     @@driver.action.send_keys(:escape).perform
    

     @@driver.action.send_keys("\xEE\x80\x8C").perform
    

    【讨论】:

      【解决方案2】:

      你知道有处理模式对话框的 API 吗?

      driver.switchTo().alert()

      例如,如果要关闭它,请使用driver.switchTo().alert().dismiss()

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-10-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-30
        • 1970-01-01
        • 1970-01-01
        • 2013-06-21
        相关资源
        最近更新 更多