• <bdo id='D9so5'></bdo><ul id='D9so5'></ul>
  • <legend id='D9so5'><style id='D9so5'><dir id='D9so5'><q id='D9so5'></q></dir></style></legend>
  • <small id='D9so5'></small><noframes id='D9so5'>

      1. <tfoot id='D9so5'></tfoot>
        <i id='D9so5'><tr id='D9so5'><dt id='D9so5'><q id='D9so5'><span id='D9so5'><b id='D9so5'><form id='D9so5'><ins id='D9so5'></ins><ul id='D9so5'></ul><sub id='D9so5'></sub></form><legend id='D9so5'></legend><bdo id='D9so5'><pre id='D9so5'><center id='D9so5'></center></pre></bdo></b><th id='D9so5'></th></span></q></dt></tr></i><div id='D9so5'><tfoot id='D9so5'></tfoot><dl id='D9so5'><fieldset id='D9so5'></fieldset></dl></div>

        关闭“确认导航"Watir 的弹出窗口

        时间:2023-10-01

          <legend id='aGL22'><style id='aGL22'><dir id='aGL22'><q id='aGL22'></q></dir></style></legend>

          <i id='aGL22'><tr id='aGL22'><dt id='aGL22'><q id='aGL22'><span id='aGL22'><b id='aGL22'><form id='aGL22'><ins id='aGL22'></ins><ul id='aGL22'></ul><sub id='aGL22'></sub></form><legend id='aGL22'></legend><bdo id='aGL22'><pre id='aGL22'><center id='aGL22'></center></pre></bdo></b><th id='aGL22'></th></span></q></dt></tr></i><div id='aGL22'><tfoot id='aGL22'></tfoot><dl id='aGL22'><fieldset id='aGL22'></fieldset></dl></div>
            <tbody id='aGL22'></tbody>
        1. <small id='aGL22'></small><noframes id='aGL22'>

            • <bdo id='aGL22'></bdo><ul id='aGL22'></ul>

                  <tfoot id='aGL22'></tfoot>
                  本文介绍了关闭“确认导航"Watir 的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试关闭确认导航"弹出窗口.这就是它在 Chrome 中的样子.

                  I am trying to dismiss "Confirm Navigation" popup. This is how it looks like in Chrome.

                  要查看弹出窗口:

                  require "watir-webdriver"
                  browser = Watir::Browser.new
                  browser.goto "http://www.gravityforms.com/demo/wp-admin/admin.php?page=gf_new_form"
                  browser.text_field(:id => "user_login").set "demo"
                  browser.text_field(:id => "user_pass").set "demo"
                  browser.button(:id => "wp-submit").click
                  browser.refresh
                  

                  目前,当我访问该页面时,我会覆盖 onbeforeunload,正如 http 中所建议的那样://watirwebdriver.com/javascript-dialogs/

                  At the moment I override onbeforeunload when I visit the page, as suggested at http://watirwebdriver.com/javascript-dialogs/

                  browser.execute_script("window.onbeforeunload = function() {};")
                  

                  所以,脚本现在看起来像这样:

                  So, the script now looks like this:

                  require "watir-webdriver"
                  browser = Watir::Browser.new
                  browser.goto "http://www.gravityforms.com/demo/wp-admin/admin.php?page=gf_new_form"
                  browser.text_field(:id => "user_login").set "demo"
                  browser.text_field(:id => "user_pass").set "demo"
                  browser.button(:id => "wp-submit").click
                  browser.execute_script("window.onbeforeunload = function() {};")
                  browser.refresh
                  

                  而且效果很好.我只是想知道是否有更好的解决方案.

                  And it works just fine. I am just wondering if there is a better solution.

                  推荐答案

                  我认为这是目前最好的方法.

                  I think that's the best way for now.

                  大约两个月前,我为此提交了 bug/feature-request.如果这会让您的事情变得更轻松,您可能想在那里发表评论并投支持票.

                  I filed a bug/feature-request for this about two months back. You might want to comment there and add a vote of support if it's something that would make things easier for you.

                  这篇关于关闭“确认导航"Watir 的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Fancybox 弹出一次会话 下一篇:Python - selenium webdriver - 无法切换到注册弹出窗口

                  相关文章

                  <tfoot id='GHuOP'></tfoot>
                1. <i id='GHuOP'><tr id='GHuOP'><dt id='GHuOP'><q id='GHuOP'><span id='GHuOP'><b id='GHuOP'><form id='GHuOP'><ins id='GHuOP'></ins><ul id='GHuOP'></ul><sub id='GHuOP'></sub></form><legend id='GHuOP'></legend><bdo id='GHuOP'><pre id='GHuOP'><center id='GHuOP'></center></pre></bdo></b><th id='GHuOP'></th></span></q></dt></tr></i><div id='GHuOP'><tfoot id='GHuOP'></tfoot><dl id='GHuOP'><fieldset id='GHuOP'></fieldset></dl></div>
                2. <legend id='GHuOP'><style id='GHuOP'><dir id='GHuOP'><q id='GHuOP'></q></dir></style></legend>
                3. <small id='GHuOP'></small><noframes id='GHuOP'>

                      <bdo id='GHuOP'></bdo><ul id='GHuOP'></ul>