Forum Discussion

efuller's avatar
efuller
Occasional Contributor
7 years ago

Browser Loop issue

Hello Everyone,    What I'm trying to do is separate certain functions into Unit Tests and then combine them into a new test as an Integration test.   As an example, here is what I'll be doing: ...
  • tristaanogre's avatar
    7 years ago

    It would be helpful to see the code/screenshot of the keyword test for the sign in portion.  Basically, when you write a browser action like launching a browser, you have an option to specify either to use a specific browser or to use the brower from within the loop.

     

    Basically, in Test1, remove the part about starting FireFox.  The BrowserLoop operation in Keyword Tests (if that's what you're using) automatically launches the browser so, in subsequent tests and test steps, you don't need to actually launch the browser.

     

    If you're not using Keyword tests, the methodology is still the same.... you use a generic "browser" call to launch the browser and, in your subsequent calls, simply reference "Aliases.browser" or however you're referencing the browser as in this sample code from the help:


    function IterateBrowsers1()
    {
      for (let browser of Browsers)
      {
        // Start a browser instance
        browser.Run();
        // Perform web testing
        // ...
        // Close the browser instance
        Aliases.browser.Close();
        
      }
    }

    OR

     

     

    function IterateBrowsers2()
    {
      for (var i = 0; i < Browsers.Count; i++)
      {
        browser = Browsers.Item(i);
        // Start a browser instance
        browser.Run();
        // Perform web testing
        // ...
        // Close the browser instance
        Aliases.browser.Close();
      }
    }