【发布时间】:2019-11-16 08:19:49
【问题描述】:
我正在尝试在单个测试中处理多个浏览器实例。一旦在一个浏览器实例中完成操作。我的脚本将打开新的浏览器实例,并且为了忽略同步,我编写了一个函数,但它不起作用甚至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"
【问题讨论】:
-
除了
browser的所有方法都返回Promises,因此需要await -
@sergey,你说的是哪种浏览器方法??
标签: javascript angularjs protractor cucumberjs