Showing posts with label Code to close all Internet explorer browser process using QTP. Show all posts
Showing posts with label Code to close all Internet explorer browser process using QTP. Show all posts

14 May 2013

How to terminate all instances of internet explore using collections

How to terminate all instances of internet explore using collections


'Code to close all Internet explorer browser process using QTP

Dim ObjWMIService, IExplore,IItem

Dim strComputer

strcomputer="."

'Get the WMI object
Set ObjWMIService=GetObject("Winmgmts:\\"& strcomputer & "\root\cimv2")

'Get collection of processes for with name iexplore.exe

set IExplore=ObjWMIService.execquery("Select * from win32_process where name='iexplore.exe'")

'Loop through each process and terminate it

For each IItem in IExplore

IItem.terminate

Next

Set IExplore= Nothing

Set ObjWMIService= Nothing