Knowledge Base Article

Home Page > Knowledge Base > Rapise

Home Page > Knowledge Base > Rapise > Rapise Web

Article How Do I Ensure No Other Browser Windows Open

by Adam S on 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.

 

Attachments
Article Info
Last Updated: 5/4/2015
Article ID: KB18
# Views: 1347
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.