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

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

      量角器切换到上一个选项卡

      时间:2023-10-12
        <tbody id='vdLjN'></tbody>

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

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

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

            • <tfoot id='vdLjN'></tfoot>
                本文介绍了量角器切换到上一个选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                打开一个新标签(第二个)后,我试图切换到第一个标签.

                After opening a new tab (second) I'm trying to switch to the first tab.

                     common.clickOpenNewSession(); //it opens the new tab
                
                 browser.getAllWindowHandles().then(function (handles) {
                    var secondWindowHandle = handles[1];
                    var firstWindowHandle = handles[0];
                    browser.switchTo().window(secondWindowHandle).then(function () { //the focus moves on new tab
                        browser.sleep(3000);
                        expect(browser.driver.getCurrentUrl()).toContain("url");
                //do some actions
                
                    });
                //below it doesn't work. I try to go back on previous tab without closing the second tab
                    browser.actions().sendKeys(protractor.Key.CONTROL).sendKeys(protractor.Key.TAB).perform();
                    browser.sleep(4000);
                    browser.driver.switchTo().window(firstWindowHandle);
                    browser.setLocation('http://google.com');
                });
                

                推荐答案

                问题是你试图通过使用 ctrl + tab 转到上一个选项卡,而不是使用窗口句柄切换回来.这在 WebDriver 中不受支持,因为使用 ctrl + tab 是一种系统操作,不能在您的浏览器上为所有操作系统/浏览器模拟.只需再次使用 browser.switchTo().

                The problem is that you're trying to go to the previous tab by using ctrl + tab, instead of using the window handles to switch back. This is not supported in WebDriver, because using ctrl + tab is a system operation, and can't be emulated on your browser for all OS/browsers. Just use browser.switchTo() again.

                这篇关于量角器切换到上一个选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何设置 HTML5 type="date";使用 Selenium/Prot 下一篇:量角器中的计数()与长度

                相关文章

                最新文章

                • <bdo id='BrGqo'></bdo><ul id='BrGqo'></ul>
                <tfoot id='BrGqo'></tfoot>
              1. <small id='BrGqo'></small><noframes id='BrGqo'>

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