Forum Discussion
TanyaYatskovska
Alumni
13 years agoHi Yuri,
Here is another script:
function closeAllBrowsers()
{
var browserNames = new Array("iexplore", "firefox", "chrome");
for(var i in browserNames)
{
closeBrowser(browserNames);
}
}
function closeBrowser(BrowserNamer)
{
if (Sys.WaitBrowser(BrowserNamer).Exists)
{
Log.Message("Browser '" + BrowserNamer + "' is open. Closing the browser");
Sys.Browser(BrowserNamer).Close();
}
}
Also, you can iterate though all Browser objects in the object tree and close them:
function closeAllBrowsers_2()
{
var browsers = Sys.FindAll("ObjectType", "Browser", 1);
browsers = (new VBArray(browsers)).toArray();
for(var i in browsers)
{
Log.Message("Browser '" + browsers.ProcessName + "' is open. Closing the browser");
browsers.Close();
}
}