Cross Browser Testing¶
Choosing the Browser When Creating a Test¶
When you first create a Rapise test with the Methodology set to Web you will be asked to choose the initial web browser profile:
You can run your recording in a different browser than the one in which it was recorded.
Selecting a new Playback Browser¶
In the right top corner of Rapise window expand the dropdown with available browser.
Change the browser to either one of the Selenium WebDriver based browser profiles, or one of the native browsers such as Firefox, Internet Explorer or Chrome.
Once you have changed this setting, Playback the script normally and it will playback in the selected browser.
Changing this setting will effectively set the value of the g_browserLibrary
global variable.
Note
In Rapise 6.3+ you may define local profiles.
Important
Since Rapise 7.3 it is recommended to use Selenium WebDriver based profiles for all web tests.
Playback in Multiple Browsers¶
Using Framework Parameters¶
Rapise 8
In Rapise 8 and above the recommended way of multi-browser testing is via framework parameters.
Check out the KB article: Rapise 8.0: how to run test cases on different browsers.
Using Input Data Table¶
Rapise 7
In Rapise 7 the recommended way of multi-browser testing is via Input Data Table.
Check out the webinar: Parallel Execution of Tests with Rapise & SpiraTest.
Using SpiraTest and Test Case Parameters¶
obsolete
Executing a test in multiple browsers is slightly more complicated. We recommend that you use SpiraTest Test Sets where you may define multiple test cases pointing to the same Test with a different g_browserLibrary parameter value.
See the SpiraTest Integration topic for detailed information.
Changing Browser with SelectBrowserProfile¶
obsolete
You may use Navigator.SelectBrowserProfile
as follows:
Navigator.SelectBrowserProfile("BROWSER PROFILE 1");
Navigator.Open('URL');
...
Navigator.Close();
Navigator.SelectBrowserProfile("BROWSER PROFILE 2");
Navigator.Open('URL');
...
Navigator.Close();
Important
Navigator.Close
is required to switch the browser.
In RVL it will look like:
Or, the same using the Loop:
Using DoInvokeTest¶
obsolete
To iterate through browsers in Rapise create a new test with Web methodology.
Now add a reference to the Web test you want to run in different browsers. In the Files
view right click the test node and choose Add File(s)...
. Provide the path to *.sstest
file. You will see the reference added to the Files
view.
Drag the reference to the editor window. Rapise will generate DoInvokeTest
call.
To execute a test with a given browser profile you need a pair of commands.
Navigator.SelectBrowserProfile("BROWSER PROFILE");
Global.DoInvokeTest('PATH TO THE TEST');
So to run the test in three different browsers we get the following content of the Test.js
:
function Test(params)
{
Navigator.SelectBrowserProfile("Selenium - Chrome");
Global.DoInvokeTest('%WORKDIR%/../Web Testing 2/Web Testing 2.sstest');
Navigator.SelectBrowserProfile("Selenium - Edge");
Global.DoInvokeTest('%WORKDIR%/../Web Testing 2/Web Testing 2.sstest');
Navigator.SelectBrowserProfile("Selenium - Firefox");
Global.DoInvokeTest('%WORKDIR%/../Web Testing 2/Web Testing 2.sstest');
}
g_load_libraries=["Web"];
In RVL it will look like: