Forum Discussion

twhitehouse's avatar
twhitehouse
Contributor
10 years ago

'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?

 

 

  • k_de_boer03's avatar
    k_de_boer03
    10 years ago

    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().

    • k_de_boer03's avatar
      k_de_boer03
      Contributor

      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().

      • twhitehouse's avatar
        twhitehouse
        Contributor

        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.

    • twhitehouse's avatar
      twhitehouse
      Contributor

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

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        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.