by  Adam S Monday, May 4, 2015
When running a test you will often want to make sure there are no other browser windows open. This is commonly done either at the start or end of the test. This article describes how you do this.

Inside your Rapise test's user functions file (mytest.user.js), add the following:

function CloseBrowser()
{
 switch (g_browser_library)
 {
  case "Internet Explorer HTML":
   
Global.DoLaunch('Taskkill /IM iexplore.exe');
   break;

  case "Firefox HTML":
   Global.DoLaunch('Taskkill /IM firefox.exe');
   break;

  case "Chrome HTML":
   
Global.DoLaunch('Taskkill /IM chrome.exe');
   break;   
 }
}

Then just call the CloseBrowser() function from your main test script.

=====================================================

Alternatively, you can use the following:

function KillBrowser()
{
 switch (g_browser_library)
 {
  case "Internet Explorer HTML":
   Global.DoKillByName('iexplore.exe');
   break;
  case "Firefox HTML":
   Global.DoKillByName('firefox.exe');
   break;
  case "Chrome HTML":
   Global.DoKillByName('chrome.exe');
   break;   
 }
}

Then just call the KillBrowser() function from your main test script.

 

Article Info
  • Last Updated: 5/4/2015
  • Article ID: KB18
  • Views: 1485