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
Mention what is select case statement?
How will you get the smallest subscript of an array in vbscript?
How to open excel in vb script?
Explain the operator precedence in vb script?
Explain the support of asp for vb script functionality?
Explain about the support of asp for vb script functionality?
I want to run QTP script on Linux server is it possible to do this by connecting Windows to Linux through VPN/Terminal Server and just run the script on Linux server.
write a function to read the items from combobox of Flight reservation & save in excel (QTP)??
I am working on QTP, got struck in one place.. In my application depending upon configuration WebEdit count is increasing/ decreasing.. how to get these webedits..
Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?
Mention what is vbscript?
what is used of Property........End Property loop ? how to write the script for it?
Can any one provide code for Mid(string,start[,length]). I have been asked to write code for Mid(). i.e We need to define our own function say MyMid() which should behave same like built-in Mid function
What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?
What is the use of option explicit statement?