WORKING WITH QTP

TestEveryThinG

Get Browser(iexplore) Count using VB script

Posted by rajivkumarnandvani on November 1, 2009

bcount = Get_ApplicationCount(“iexplore.exe”)

msgbox bcount

Public Function Get_ApplicationCount( byval sApplicationExe)

Dim strComputer

Dim objWMIService

Dim colProcesses

Dim objProcess

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)

Set colProcesses = objWMIService.ExecQuery (“Select * from Win32_Process Where Name = ‘”&sApplicationExe&”‘”) Get_ApplicationCount = colProcesses.count

Set objWMIService = Nothing

Set colProcesses=Nothing

End Function

If  bcount >0  Then

set objBrowser = Description.Create()

objBrowser(“micclass”).value =”Browser”

objBrowser(“CreationTime”).value=bcount-1

msgbox Browser(objBrowser).GetROProperty(“title”)

else

msgbox “No internet explorer open”

End If

Leave a comment