Thursday 14 March 2013

How to close all IE browsers in QTP?

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

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.