Protractor 量角器-无法从我的angular js应用程序切换到twitter授权弹出窗口
我使用的是页面对象模型,在这里我调用下面的函数,这个函数是用我的规范中的Page_object.js编写的。我已经尝试了所有可能的方法,但它在切换时总是失败。请帮忙Protractor 量角器-无法从我的angular js应用程序切换到twitter授权弹出窗口,protractor,Protractor,我使用的是页面对象模型,在这里我调用下面的函数,这个函数是用我的规范中的Page_object.js编写的。我已经尝试了所有可能的方法,但它在切换时总是失败。请帮忙 var Twitter_Actions = function (){ this.authorizeAccount = function(username,pswd){ browser.ignoreSynchronization = true; return browser.getAllWindowHandles(
var Twitter_Actions = function (){
this.authorizeAccount = function(username,pswd){
browser.ignoreSynchronization = true;
return browser.getAllWindowHandles().then(function (handles) {
var popUpHandle = handles[1];
expect(popUpHandle).toBeDefined();// Asrton to cnfrm pop-up is defined
browser.switchTo().window(popUpHandle); // Failing on Switch
var windowtitle = browser.getTitle().then(function(webpagetitle){
return webpagetitle;
});
console.log(windowtitle);// Printing title on the console to debug
browser.executeScript('window.focus();');
element(by.name("session[username_or_email]")).sendKeys(username);
element(by.name("session[password]")).sendKeys(pswd);
element(by.id('allow')).click();
});
}
}
我尝试了你的功能来授权网站上弹出的twitter授权弹出窗口。工作正常。你可以看到完整的代码,我尝试了你的功能来授权推特授权弹出窗口,在网站上抛出。工作正常。您可以看到完整的代码