write generic functions for webapplication?like
generic function for webedit
generic function for webbutton
generic function for links
Answer / manjunathareddy
Function AppTest(ObjectType,Objname,Testvalue)
Set oBrowser=Browser("name:=.*")
Set oPage=oBrowser.Page("title:=.*")
Select Case ObjectType
Case "WebEdit"
If oPage.WebEdit("name:="& Objname).Exist Then
oPage.WebEdit("name:="& Objname).Highlight
oPage.WebEdit("name:="& Objname).Set Testvalue
Reporter.ReportEvent micPass,"WebEdit Exist","Set
the"&Testvalue
Else
Reporter.ReportEvent micFail,"WebEdit not Exist","Not
set the"&Testvalue
End If
Case "Image"
If oPage.Image("name:="& Objname).Exist Then
oPage.Image("name:="& Objname).Highlight
oPage.Image("name:="& Objname).Click
Reporter.ReportEvent micPass,"Image Exist","Complted
click task"
Else
Reporter.ReportEvent micFail,"Image not Exist","Not
completed click task"
End If
Case "Link"
If oPage.Link("name:="& Objname).Exist Then
oPage.Link("name:="& Objname).Highlight
oPage.Link("name:="& Objname).Click
Reporter.ReportEvent micPass,"Link Exist","Complted
click task"
Else
Reporter.ReportEvent micFail,"Link not Exist","Not
completed click task"
End If
Case "WebList"
If oPage.WebList("name:="& Objname).Exist Then
oPage.WebList("name:="& Objname).Highlight
oPage.WebList("name:="& Objname).Select Testvalue
Reporter.ReportEvent micPass,"WebList
Exist","Selection done"
Else
Reporter.ReportEvent micFail,"WebList not
Exist","Selection not done"
End If
End Select
End Function
Is This Answer Correct ? | 0 Yes | 0 No |
What are the advantages of vbscript?
how do you make the variable declaration mandatory?what is the use of "option explicit"?
we executed QTP scripts in one browser(i.e IN)same scripts is working on another browsers or not (i.e mean netscap,m azol..like )
write a program to display the system specifications of client system with the help of vb script.
Explain about the extension .hta?
Difference between Function and Sub routine?
what is resorceallocation
How to open excel in vb script?
How will you get a subset of a array in vbscript?
What is Procedure or Subroutine in VB Script?
Which loop is used in case of arrays in the vbscript language?
How to Import data from a file (file is on the desktop) to the data table