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

      1. <small id='lTX1j'></small><noframes id='lTX1j'>

      2. <tfoot id='lTX1j'></tfoot>
        <legend id='lTX1j'><style id='lTX1j'><dir id='lTX1j'><q id='lTX1j'></q></dir></style></legend>

        通过 Selenium 在 Chrome 中启用弹出窗口

        时间:2023-06-27
      3. <legend id='AflUZ'><style id='AflUZ'><dir id='AflUZ'><q id='AflUZ'></q></dir></style></legend>
            <bdo id='AflUZ'></bdo><ul id='AflUZ'></ul>
              <tbody id='AflUZ'></tbody>

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

              <small id='AflUZ'></small><noframes id='AflUZ'>

              1. <tfoot id='AflUZ'></tfoot>

                • 本文介绍了通过 Selenium 在 Chrome 中启用弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如果我的问题听起来很重要,我提前道歉,我是 QA 和 Selenium 的新手.

                  My apologies in advance if my question sounds primary, I am very new at QA and Selenium.

                  我正在使用 Java 和 Selenium 编写测试,在我的测试步骤之一,当我单击一个按钮时,它应该打开另一个窗口,但 Chrome 阻止了弹出窗口,我可以通过 Selenium 启用弹出窗口吗?

                  I am using Java and Selenium to write a test, at one of my test's step when I click on a button it is supposed to open another window but Chrome blocks the popup window, can I enable popup by Selenium?

                  推荐答案

                  好吧,您需要使用自定义配置来初始化 ChromeDriver,这将禁用该标志来阻止弹出窗口.从这个 站点,它的命令行开关是 disable-popup-blocking.因此,使用 ChromeOptionsDesiredCapabilities,您可以使用 DesiredCapabilities.setCapability() 函数.

                  Well, you need to initialize the ChromeDriver with a customized configuration which will disable the flag to block popups. From this site, the command line switch for it is disable-popup-blocking. So, using ChromeOptions and DesiredCapabilities, you add the desired config using the DesiredCapabilities.setCapability() function.

                  ChromeOptions options = new ChromeOptions();
                  options.addArguments("test-type");
                  options.addArguments("disable-popup-blocking");
                  DesiredCapabilities capabilities = DesiredCapabilities.chrome();
                  capabilities.setCapability(ChromeOptions.CAPABILITY, options);
                  WebDriver driver = new ChromeDriver(capabilities);
                  

                  刚刚在这个 上找到了相同的解决方案网站.

                  这篇关于通过 Selenium 在 Chrome 中启用弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                      <tbody id='SmV6Z'></tbody>
                    1. <legend id='SmV6Z'><style id='SmV6Z'><dir id='SmV6Z'><q id='SmV6Z'></q></dir></style></legend>

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

                      • <small id='SmV6Z'></small><noframes id='SmV6Z'>

                          <tfoot id='SmV6Z'></tfoot>