![](/img/trans.png)
[英]Protractor: multiple browser instances in a Non-Angular app: ignoreSynchronization Not working
[英]How to setup the ignoreSynchronization when dealing with multiple browser instances in a signle test
我正在嘗試在單個測試中處理多個瀏覽器實例..一旦在一個瀏覽器實例中完成操作..我的腳本將打開新的瀏覽器實例並忽略同步我寫了一個 function 但它不工作甚至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);
});
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"
我的問題通過調用 waitForAngularEnabled 2 times1st 得到了解決
第一次應該在瀏覽器創建時,第二次應該在 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")
}
這是我的解決方案,如果有人有更好的解決方案,請隨時發布。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.