Forum Discussion
I *think* (not 100% sure here) that if TC fires the browser instance, it may start the 32 bit version.
I start mine with a shell object and use that to run the executable. But I don't give a file path. Just the browser name. The OS/application figures it out. But I do recall seeing both "iexplore" and "iexplore*32" in the process list. But that's never caused me any issues opening and closing browsers.
But then, I do use Chrome 95% of the time (although I do routinely have 4 or 5 open at a time). And I just use the "Close" method of the Page object. I don't kill the process. If IE (or Chrome) doesn't close properly for some reason, it's regarded as a test failure and reported as such. We prefer to catch things like this rather than paste over them by killing the process in case it's something we've done that's causing the hang.
Still not sure where the second instance is coming from in this case ....
Hello all,
Thank you so much for all your solutions. The problem was with my machine. Though I re-installed internet explorer11. There was 'iexplore.exe' service running even if we close the browser.
I did not notice this behaviour before. May be this is because of activation of 'add-ons'.
Please let me know if anyone is facing the same.
- Colin_McCrae9 years agoCommunity Hero
kjadhavkunal wrote:The problem was with my machine. Though I re-installed internet explorer11. There was 'iexplore.exe' service running even if we close the browser.
Did you manage to fix it in the end?
Interested to hear how if you'd already tried re-installing IE, and that didn't fix it first time ....
** EDIT **
I'm not sure the code from sanjay0288 would work here as it relies on counts of browsers to determine loop lengths. And I'm not sure if the invisible one in this case would be caught that way.
However, if you modified to look for all instances of the "iexplore*" process (with the wildcard there to catch any "*32" versions) and kill those, it might have done it. Even with the dodgy invisible version hiding in the background.
ie. Use processes to drive the loop. Not browser instances.
- sanjay02889 years agoFrequent Contributor
Kill the instances at the process level. The code to achieve the same has already been shared in the previous posts.
For the second part of the problem not sure why the process always be in running state. Because of the addons you could be facing this issue. You can try going through the below mentioned link to figure out the root cause of the problem.
- shankar_r9 years agoCommunity Hero
Colin_McCraementioned, you can close the browser instances using process like below
function test() { var tempBrowsers = Sys.FindAllChildren("ProcessName","iexplore"); for(var i=0;i < tempBrowsers.length ; i++) { tempBrowsers[i].Close(); aqUtils.Delay(5000,"Wating for IE to close"); } } - Colin_McCrae9 years agoCommunity Hero
shankar_r .... that could miss some. You're only searching for "iexplore". There can also be "iexplore*32" instances (which are something to do with tabbed browsing from what I can gather). I believe it's possible for these to get left behind when IE is closed (sounds like that was what was happening to kjadhavkunal). Hence why I included the "*" wildcard.
- shankar_r9 years agoCommunity Hero
Got you Colin_McCrae, I changed the code like below
function test() { var tempBrowsers = Sys.FindAllChildren("ProcessName","iexplore*"); for(var i=0;i < tempBrowsers.length ; i++) { tempBrowsers[i].Close(); aqUtils.Delay(5000,"Wating for IE to close"); } }As per my understanding, If we have IE with multiple tabs, each tab will have one separate process allocated hence above code should work for multiple tabs or multiple browser instances.
- Colin_McCrae9 years agoCommunity Hero
Yup. That should do it. Haven't actually tried it, but it looks right to me.
- sanjay02889 years agoFrequent Contributor
oh bad. I missed out the actual point. You can use WMI to terminate all the instances of IE.
strComputer = "."
strProcessToKill = "iexplore.exe"
SET objWMIService = GETOBJECT("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
SET colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")FOR EACH objProcess in colProcess
objProcess.Terminate()NEXT
- kjadhavkunal9 years agoContributor
As I said before, its not about closing instances of a browser. I am able to see the browser is closed. But when I go to Task Manager, there is process for the same in running state.
Also, it was working fine on my machine yesterday. When I returned back from 30 minutes break again found the same issue. Currently working from another machine. Is it something machine specific?
Please help with the solutions.
Thank you in advance!
- Colin_McCrae9 years agoCommunity Hero
The last few posts ARE the solution!
Kill it at process level. Simply make sure you find and terminate all the possible variations of the process. It's pretty simple to do. A search with a wildcard (or two searches if using a * to search for a * doesn't work), and then a loop (or loops - but easy enough to get both search results into the same array if you do two searches) to kill off the found processes.
That should get round the problem., But no idea why your PC is leaving bits of process behind.