我正在尝试在一次测试中处理多个浏览器实例。在一个浏览器实例中完成操作后..我的脚本将打开新的浏览器实例,为了忽略同步,我编写了一个one函数,但它不起作用,甚至browserInstance.ignoreSynchronization=true也不起作用。有没有人能帮帮我。
等级库文件
this.Then(/^User tried to open in new browser instance$/,async function(){
browser2=await utility.openNewBrowser(browser);
//this common function is not working
//utility.ignoreSync(browser2);
browser2.ignoreSynchronization=true;
browser2.get("https://facebook.com");
page2=new facebook(browser2);
console.log(await browser2.getTitle()+" title");
browser2.sleep(5000);
});ignoreSynchronization的通用函数
var utility=function(){
this.openNewBrowser=function(browserInstance){
return browserInstance.forkNewDriverInstance();
}
this.ignoreSync=function(browserInstance){
browserInstance.ignoreSynchroniation=true;
}
}
module.exports=new utility();错误日志
Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"发布于 2019-11-19 01:34:24
我的问题已经通过2 times1st调用waitForAngularEnabled得到了解决
第一次它应该在时间的浏览器创建和第二次它应该是在URL加载之后
代码
this.ignoreSync=async function(url){
console.log("entered in to ignore");
browserInit.waitForAngularEnabled(false);
await browserInit.get(url);
browserInit.waitForAngularEnabled(false);
console.log("came out from ignore")
}这是我的解决方案,如果有人有更好的解决方案,请随时张贴。
https://stackoverflow.com/questions/58888844
复制相似问题