简体   繁体   中英

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

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"

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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