在Signle测试中处理多个浏览器实例时如何设置ignoreSynchronization [英] How to setup the ignoreSynchronization when dealing with multiple browser instances in a signle test
问题描述
我正在尝试在一个测试中处理多个浏览器实例..一旦在一个浏览器实例中完成了操作..我的脚本将打开新的浏览器实例,并且为了忽略同步,我编写了一个函数,但是它不起作用甚至 browserInstance.ignoreSynchronization = true
也不起作用.有人可以帮我吗?
I am trying to dealing with multiple browser instances in a single test.. once the action is done in one browser instance.. my script will open the new browser instance and for ignoresynchronization i wrote a one function but it is not working and even browserInstance.ignoreSynchronization=true
also not working. can someone help me in this.
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 log
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次即可.
My Issue has got resolved by just calling the waitForAngularEnabled by 2 times1st
第一次应该是在创建浏览器时第2次应该是在加载URL之后
1st time it should at the time of browser creation and 2nd time it should be after the URL load
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")
}
这是我的解决方案,如果有人有更好的解决方案,请随时发布.
this is my solution and if anybody have better solution please feel free to post it.
这篇关于在Signle测试中处理多个浏览器实例时如何设置ignoreSynchronization的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!