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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: