Forum Discussion
kevin_kapell
Frequent Contributor
I am presuming you are having a problem with IE 11?
A function to close browsers and kill processes will help. I have mine run whenever I start the script or need a new browser session.
However TestComplete still has a bug where the IE process shows under the TestComplete App in the Task Manager. If you pen Task Manager when this happens and expand the TestComplete app that is listed you can see the IE process and kill it from Task Manager. While it happens often I cannot reproduce at will so no fix from SmartBear for it.
While othere may have a better function this one should work for you.
function CloseBrowserProcess(BrowserProcess)
{
Log["Event"]("Starting function CloseBrowserProcess with the browser " + BrowserProcess);
{
Log["Event"]("Starting function CloseBrowserProcess with the browser " + BrowserProcess);
//This function is used to close a specific browser processes that may still be running after doing a close command
var process;
switch(BrowserProcess)
{
case "btIExplorer":
case -1:
case "iexplore":
process = Sys.WaitProcess("iexplore",2000);
break;
case "btChrome":
case -3:
case "chrome":
process = Sys.WaitProcess("chrome",2000);
break;
var process;
switch(BrowserProcess)
{
case "btIExplorer":
case -1:
case "iexplore":
process = Sys.WaitProcess("iexplore",2000);
break;
case "btChrome":
case -3:
case "chrome":
process = Sys.WaitProcess("chrome",2000);
break;
case "btFirefox":
case -2:
case "firefox":
process = Sys.WaitProcess("firefox",2000);
break;
case -2:
case "firefox":
process = Sys.WaitProcess("firefox",2000);
break;
case "btEdge":
case -6:
case "edge":
process = Sys.WaitProcess("edge",2000);
break;
case -6:
case "edge":
process = Sys.WaitProcess("edge",2000);
break;
default:
Log["Warning"]("Browser process not identified. Value = " + BrowserProcess);
return false;
}
if (process.Exists)
{
Log.Event("Closing browser");
process.Close();
aqUtils.Delay(1000,"Delay for browser to be closed");
if(process.Exists)
{
Log.Event("Terminating browser");
process["Terminate"]();
}
}
else
{
Log.Event("The browser does not appear to be running.");
}
}
Log["Warning"]("Browser process not identified. Value = " + BrowserProcess);
return false;
}
if (process.Exists)
{
Log.Event("Closing browser");
process.Close();
aqUtils.Delay(1000,"Delay for browser to be closed");
if(process.Exists)
{
Log.Event("Terminating browser");
process["Terminate"]();
}
}
else
{
Log.Event("The browser does not appear to be running.");
}
}
TanyaYatskovska
5 years agoSmartBear Alumni (Retired)
Related Content
- 5 years agodjvakarjoshi1