write generic functions for webapplication?like
generic function for webedit
generic function for webbutton
generic function for links



write generic functions for webapplication?like generic function for webedit generic function for ..

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

Post New Answer

More VB Script Interview Questions

How should i Create Email invite with server-side Coding?

0 Answers   Altair,


What is the main difference between function and sub-procedure?

0 Answers  


If a calulator having 3 buttons (of any number)in 3 of them one is not working properly due to which answer is wrong always. write a script to find out which button is not working properly ?

0 Answers  


how to find the textfile in the folder and copy file from one folder to another folder useing parameterigation in QTP

1 Answers   Accenture,


What are the disadvantages of vbscript?

0 Answers  


what does create object actually do when you call it in vbscript?

1 Answers   Cap Gemini,


Write a vbscript procedure that converts feet to inches. Hint: there are 12 inches in a foot?

0 Answers  


Can anyone help me in write coding to get this pattern * ** *** ****

3 Answers  


how to organize files in object repository of qtp

1 Answers  


What is the use of option explicit in vbscript?

0 Answers  


Explain the extension .hta?

0 Answers  


Explain How do you create a recordset object in vbscript?

0 Answers  


Categories