How to setup the ignoreSynchronization when dealing with multiple browser instances in a signle test

我的梦境 提交于 2019-12-11 14:35:00

问题


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.

Spec file


    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);
    });

Common function to ignoreSynchronization

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"

回答1:


My Issue has got resolved by just calling the waitForAngularEnabled by 2 times1st

1st time it should at the time of browser creation and 2nd time it should be after the URL load

Code

 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.



来源:https://stackoverflow.com/questions/58888844/how-to-setup-the-ignoresynchronization-when-dealing-with-multiple-browser-instan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!