Thursday, 17 January 2013

Kill Browser Function Using QTP or VB Script

Kill Browser Function Using QTP or VB Script

Function Kill_Browser_Processes()
       Do while Browser("micclass:=Browser", "index:=0").Exist
              sBrowserTitle = "Mercury TestDirector 8.0 SP2"
              sBrowserName = Browser("micclass:=Browser", "index:=0").GetROProperty ("title")
             If Instr (sBrowserName, sBrowserTitle)  Then
                  Do while Browser("micclass:=Browser", "index:=1").Exist
       'To close any unwanted popups
       If Browser("Optus Online Store").Dialog("Microsoft Internet Explorer").Exist(0) Then
        Browser("Optus Online Store").Dialog("Microsoft Internet Explorer").WinButton("OK").Click
       End If
      
                      sBrowserName = Browser("micclass:=Browser", "index:=1").GetROProperty ("title")
                         If Instr (sBrowserName, sBrowserTitle) Then
                 Exit Do
                         Else
       'To close any unwanted popups
       If Browser("Optus Online Store").Dialog("Microsoft Internet Explorer").Exist(0) Then
        Browser("Optus Online Store").Dialog("Microsoft Internet Explorer").WinButton("OK").Click
       End If
                             Browser("micclass:=Browser","index:=1").Close
                        End If
                 Loop
  
     Exit Do
           Else
     'To close any unwanted popups
       If Browser("Optus Online Store").Dialog("Microsoft Internet Explorer").Exist(0) Then
        Browser("Optus Online Store").Dialog("Microsoft Internet Explorer").WinButton("OK").Click
       End If
                 Browser("micclass:=Browser","index:=0").Close
           End If
       Loop
End Function

No comments:

Post a Comment