You can use code below to close all internet explorer browsers in QTP
Function closeIE()
sComp = "."
'Get the WMI object
Set WMI = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
'Get collection of processes for with name iexplore.exe
Set allIE = WMI.ExecQuery("Select * from Win32_Process Where Name = 'iexplore.exe'")
'Loop through each process and terminate it
For Each IE in allIE
IE.Terminate()
Next
End Function
Function closeIE()
sComp = "."
'Get the WMI object
Set WMI = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
'Get collection of processes for with name iexplore.exe
Set allIE = WMI.ExecQuery("Select * from Win32_Process Where Name = 'iexplore.exe'")
'Loop through each process and terminate it
For Each IE in allIE
IE.Terminate()
Next
End Function
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs