Forum Discussion

nastester's avatar
nastester
Regular Contributor
7 months ago

Parallel test execution using multiple local headless browsers

Is the title of this post possible?

I am trying to run two scripts in parallel using local headless browsers:

 

When I try running, User1Login passes but User2Login fails with the error "Unable to find the object Sys.Browser("Remote")". Switching the order, User2Login passes but User1Login fails (they are the same script but I am passing in a different user).


What am I doing wrong? Is what I am trying to do even possible? 
It seems like my second script can't use the same Sys.Browser("Remote").  Can I add something in parameters?

    • nastester's avatar
      nastester
      Regular Contributor

      This is a snippet from the script.

      I am launching a remote browser and then assigning it to a variable called browser which i use for the page objects:

      function headlessLogin(env, user) {
        
        //Setup and launch headless browser
        var url = env;
        var server = "localhost";
        var capabilities = {
          "browserName": ProjectSuite.Variables.browser,
          "screenResolution": "1920x1080"
        };
      
        Browsers.RemoteItem(server, capabilities).Run(url);
        var browser = Sys.Browser("Remote");
        
        //Enter User
        var page = browser.Page("https://login.microsoftonline.com/e7520e4d-d5a0-488d-9e9f-949faae7dce8/oauth2/v2.0/authorize*");
        page.Wait();
        page.FindElement("//input[@name='loginfmt']").Click();