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


Please Help Members By Posting Answers For Below Questions

Which keyword is used to declare a variable in the vbscript language?

714


how to acces the remote mechine using vb cript(QTP)

1789


Can u describe what kind of testing are for OTC derivates by banks.

1895


How to replace junk code recorded by QTP with a mall function.

1868


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

13525


what is event handling?

779


Mention what is select case statement?

742


why variable name should not exceed 255 characters?

2004


Mention what is variant in vbscript?

735


what is the standards used for writing the script in QTP

2089


Mention what is the use of option explicit in vbscript?

775


does anyone have qtp11.0 license key.Please sendit to my mail id-rrvv2011@gmail.com...Thanks

2717


Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.

1849


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..

2270


Mention what is vbscript procedures?

764