We have a function which accesses two types of controls like button and list box in standard windows app. The function uses only the control name as arguments, so there is no way qtp could understand what type of control it is. how to resolve this? Write 2 separate functions- 1 for button & another for list box?
Share
It depends what you want to do with the object, if you want to do something that is common to all
WinObjects(e.g.ClickorGetROProperty) you can do that, if it’s specific to different test objects you’ll have to have different methods (or at least treat it differently internally)Example for Calc.exe in scientific mode:
After running the result is
10(8 in octal)Another way to do this would be to use
ChildObjectsin order to get all the objects that match this property (in this case one), check what type of object it is (GetROProperty("micclass")) and switch on that to perform your specific actions.