Forum Discussion

kevin_kapell's avatar
kevin_kapell
Frequent Contributor
7 years ago

TestComplete does not appear to close IE11 correctly resulting in script/TestComplete hangs

I have a support ticket into SmartBear for this but I am wondering if anyone else is having this problem.When I close the IE11 browser using Test Complete script the IE process moves under the SmartBear TestComplete app in Task manager and then TC cannot open or close the process anymore.

 

The following function reproduces the problem on my PC everytime. See the comments in the script for more details on the behavior.

 

function TestSample()

{

//To reproduce the problem open Task Manager and make sure that there is no IE process runn.

//Then run this script.

 

  Browsers.Item(btIExplorer).Run(); //IE 11 browser opens. Checking Task Manager shows Internet Explorer under Apps

  aqUtils.Delay(5000, "Delayed for browser to appear.");

 

  var process = Sys.WaitProcess("iexplore",2000);

  process.Close(); //IE closes. Check Task Manager and the process is not there

  aqUtils.Delay(1000,"Delay for browser to be closed");

 

  Browsers.Item(btIExplorer).Run(); //IE 11 browser opens. Checking Task Manager shows Internet Explorer under Apps

  aqUtils.Delay(5000, "Delayed for browser to appear.");

 

  Browsers.CurrentBrowser.Navigate("https://yahoo.com"); //doing a page navigation seems to be the key that triggers the problem

 

  var process = Sys.WaitProcess("iexplore",2000);

  process.Close(); //IE disappears from the desktop but the IE process is not moved under the SmartBear TestComplte app in task manager."

  //" TC Dialog shows "Waiting for the 'iexplore process to close"

  

  Browsers.Item(btIExplorer).Run();//TC log says IE is already running but there is no browser showing }

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It's really one of the problems with IE... that it opens multiple processes in Windows and doesn't always close all processes right away when you call the close command.

    We resolved the problem with the following code which we execute instead of using the default Close method.

    function closeIEInstance() {
        var counter = 0;
        var browser;
        browser = Sys.WaitBrowser('iexplore', 1000);
        while((browser.Exists) && (counter < 60)){
            counter++;
            browser.Terminate();
            browser = Sys.WaitBrowser('iexplore', 1000);
        }  
    }