write generic functions for webapplication?like
generic function for webedit
generic function for webbutton
generic function for links
Answer Posted / 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 |
Post New Answer View All Answers
Which keyword is used to declare a variable in the vbscript language?
how to acces the remote mechine using vb cript(QTP)
Can u describe what kind of testing are for OTC derivates by banks.
How to replace junk code recorded by QTP with a mall function.
how to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me
what is event handling?
Mention what is select case statement?
why variable name should not exceed 255 characters?
Mention what is variant in vbscript?
what is the standards used for writing the script in QTP
Mention what is the use of option explicit in vbscript?
does anyone have qtp11.0 license key.Please sendit to my mail id-rrvv2011@gmail.com...Thanks
Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.
Could Anybody Please tell me What is the script for Find 3rd Largest element in the Array without using a SORT function int Find(int arr[], int size); Thanks in Advance..
Mention what is vbscript procedures?