11-29-2009, 09:24 PM
Hi Kishore,
There is nothing wrong in the code only thing is u have not declared the variable "cons1"
that is the reason which is not giving the value defined in function to get a value executed within the function u must have to declare that variable so that it would become public variable
Please find the below one
There is nothing wrong in the code only thing is u have not declared the variable "cons1"
that is the reason which is not giving the value defined in function to get a value executed within the function u must have to declare that variable so that it would become public variable
Please find the below one
Code:
Dim cons1
Set IE1=CreateObject("InternetExplorer.Application")
IE1.visible = True
IE1.navigate "www.google.com"
bpname"google","google" '' 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'
While Browser("CreationTime:=1").Exist
Browser("CreationTime:=1").Close
Wend
'Closing the browser ends'
''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''