switchWindow在IE中不起作用

时间:2016-09-21 00:26:10

标签: selenium

switchWindow在IE中不起作用

 this.browser.windowHandles(function (result) {
            var newWindow;
            if (result.value.length > 1) {
                this.browser.verify.equal(result.value.length, 2, 'There should be 2 windows open');
                newWindow = result.value[1];
                this.browser.switchWindow(newWindow)
                    .pause(1000, function() { // wait to load the 2nd window completly.
                        if(self.isInternetExplorer && self.isWin81){
                            self.browser.pause(20000);//IE on win 8.1 is slower
                        }
                    });
            }
            this.browser.waitForUrlToContain(rstl, true, 90000, function (doesIt, url) {
                console.log(url);
                this.browser.assert.ok(doesIt, 'URL ' + url + ' does not contain ' + rstl);
                if(callback){
                    callback(this.browser, isFirstLogin, extraCallbackValues);
                }
            }.bind(this));
            if (result.value.length > 1) {
                this.browser.closeWindow();
                this.browser.switchWindow(result.value[0]);
            } else {
                this.browser.back();
            }
        }.bind(this));

我有上面的代码。由于某种原因,switchWindow功能在IE中不起作用。还有其他选择吗?

0 个答案:

没有答案