Ask a Question

'Process "ieexplore" stayed in the system after the close command was used."

SOLVED
twhitehouse
Contributor

'Process "ieexplore" stayed in the system after the close command was used."

At seemingly random times in my script, Internet Explorer will remain opened.   I also have a loop to loop through all browsers on the system.  In this loop, 2 internet explorer processes are actually found.  When the first one is not closed all the way, when the script tries to do anything with the second internet explorer, the test fails right there.

 

This is what I saw in the log:

'Process "ieexplore" stayed in the system after the close command was used."

 

How can I check for and close any opened Internet Explorer processes?

 

 

8 REPLIES 8
Colin_McCrae
Community Hero

Not sure if you are killing the browser or the process. But ....

 

https://support.smartbear.com/viewarticle/72799/

 

Is a good starting point.

I use this code to close internet explorer (Jscript):

 

while(Sys.WaitProcess("iexplore").Exists){
        Sys.Process("iexplore").Close();
}

It may take a few loops before it actually closes, but I consider it a cleaner more stable way than to abruptly kill the process with Terminate().

I will give that a shot.

 

I ended up adding a delay and this allowed IE to finish closing I would assume:

 

aqUtils.Delay 5000

 

However, this is good to know in case the delay solution does not work out.  I may also end up adding this anyways as a back up.

This would be a nice catch all if IE was being stubborn, which it might be...lol.  Thanks!

The drawback I can see with k_de_boer03's approach is that it could get stuck in an eternal loop if IE resolutely refused to close. I really try and avoid anything in a test which can result in an endless loop. Especially in large, long running test suites.

 

Something like that, I would have a secondary exit clause in the loop. Either time, number of attempts, or both. If it exited due to the secondary clause, then I would attempt to kill the process. If that also failed, I would then stop the test.

That is a good point.  I did not think about getting stuck in an infinite loop.  I guess I would have found out the hard way...lol.

 

The secondary exit is a good solution to accompany the first solution though.  Looks like there are a few ways to approach this.  Thanks again.

I had used the Terminate() solution before, and hasitated to use this code for a while for the exact same reason that I was afraid that it would slow down my test suite, or possibly never end. But so far so good, never had any infite loops.

 

Maybe my test suite gained a few seconds, but I prefer this solution because when you open the browser after Terminate(), you'd often get a message like "The browser has been closed unexpectedly, would you like to restore?" or something like that, I didn't want that.

 

And besides, if a process refuses to close infinitely, then I blame the process, not the code 🙂

I would not have thought of that.  Thanks for sharing the reasoning.  This has been a helpful thread...thanks.

cancel
Showing results for 
Search instead for 
Did you mean: