Ask a Question

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

kevin_kapell
Frequent Contributor

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 }

1 REPLY 1
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);
    }  
} 

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: