繁体   English   中英

在signle测试中处理多个浏览器实例时如何设置ignoreSynchronization

[英]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);
    });

常见的function要忽略同步

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM