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 to get path of the file through scripting?

1 Answers   Hexaware,


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

0 Answers   Nous,


Explain about the support of asp for vb script functionality?

0 Answers  


a function that takes an integer array as an argument and returns the largest value in the array. Use the function in a program

1 Answers  


Mention what is byref and byval parameters in vbscript?

0 Answers  






Mention what is variant in vbscript?

0 Answers  


How to map test cases with Automation script? Please explain in details.With example Thanks for your co-operation(In Advance)

1 Answers   Google, IBM,


What are the differences between Visual Basic, VBA and VBScript? When would it be appropriate to use one as opposed to another?

1 Answers   Infosys,


Which operator can be used to do an xor operation in vbscript?

0 Answers  


What are the differences between sub procedures and function procedures?

0 Answers  


I am running a windows based application.While running the script on QTP ,The Application pop-up an Error Message as "object Disabled" in two different scenarios Scenario 1-->The Application pop-up up a Message for Max Session Reached(as the application is set to hold 2 session and if if crosses the pre-defined limit then the error message pop-up) Scenario 2-->When Network connectivity is disabled the Application screen gets greyed out in colour with no operation possible. Now through Exception handling features in QTP ,we need to do the following For Scenarion 1-->Through Exception handling we need to just accept the Message pop-up in the Application and and resume with the call function as is for Scenario 2--> Through Exception Handling featutes on QTP we need to shut down the client , restart the client and resume the call functions as it is Note: The Application returns an Error Message as "object disabled" in both the cases i.e for pop-up message and when the Apllication getting greyed out due to Network failure how can we enhance the script in such a way that for the same error message retured by the application in two different and how to handle them????

2 Answers   Sasken,


Hi All, I am facing one problem in QTP. There is link object in my application that exist in the Frame in mozilla firefox. Click event on that object is not working but once the frame is enabled/activated then click event works fine.But the frame does not have the activate property. This problem is coming in firefox only. Regards

0 Answers  


Categories