12-01-2009, 02:59 PM
Hi Kishore,
Try with the below code.
Fyi,In below code required Browser(Google) will only be closed after reporting "PASS" to Test Results.(Not all active Browsers)
Try with the below code.
Fyi,In below code required Browser(Google) will only be closed after reporting "PASS" to Test Results.(Not all active Browsers)
Code:
Dim cons1
Set IE1=CreateObject("InternetExplorer.Application")
IE1.visible = True
IE1.navigate "www.google.com"
bname="Google"
pname="Google"
bpname bname,pname '' Calling the function bpname
If (cons1>0) Then
reporter.ReportEvent micPass, "Passed","Links found"
else
reporter.ReportEvent micFail, "Failed","Links NOT found"
End If
'Closing the browser'
Set br_obj=Description.Create
br_obj("micclass").Value="Browser"
br_obj("title").Value="Google"
Set br=Desktop.ChildObjects(br_obj)
For i=0 to br.count-1
Act_br_name=br(i).GetRoProperty("title")
If Act_br_name=bname Then
br(i).close
End If
Next
''Start of the function bpname
Function bpname(bname, pname)
Set obj=description.Create
obj("html tag").Value ="A"
set var = browser("name:=" &bname).page("title:="&pname).ChildObjects(obj)
cons1=var.count
msgbox cons1
End Function
''end of the function bpname''