The way to do this (when you don't want to use SpiraTest to perform the looping) is to create two arrays, one for the web application url, and one array with the browser profile names. Then you need to tell Rapise to loop through this array of browsers and for each browser, load that browser library at runtime and execute the test.
* This sample demonstrates how to use the same scenario in different web browsers: IE, Chrome and Firefox.
* This approach is useful for development stage where tests are being designed. Later it is recommended to use
* Spira to drive cross browser execution by switching g_browserLibrary parameter (see https://www.inflectra.com/Support/KnowledgeBase/KB86.aspx).
* The function "Deposit" contains the set of steps requried to deposit some amount
* on site "https://www.inflectra.com/SampleATM"
* This function was created automatically by recording the actions in Firefox.
* Then it was modified to load all browser libraries on the startup:
* g_load_libraries=["Internet Explorer HTML", "Firefox HTML", "Chrome HTML"];
* And then we iterate through all browsers by calling Navigator.SelectBrowserProfile(profile),
* where profile is "Internet Explorer HTML", "Chrome HTML" or "Firefox HTML".
var browserProfiles=["Internet Explorer HTML", "Chrome HTML", "Firefox HTML"];
for(var i in browserProfiles)
// For recording:
// For playback:
// g_load_libraries=["Internet Explorer HTML", "Firefox HTML", "Chrome HTML"];
g_load_libraries=["Internet Explorer HTML", "Firefox HTML", "Chrome HTML"];
The key is that you need to load all of the libraries during playback so that the test script can dynamically change which browser to use based on the position in the browser array. However for learning or recording you need to only have the single browser library loaded that you are using for recording. If you don't do this, Rapise will get confused and try to record using all three libraries at the same time - which doesn't work.
The full code sample is attached.