Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make a function for an object that has a large number of parent objects
#2
Not Solved
Hi, try this:
Code:
PUBLIC FUNCTION CreateObjDes(ObjectFatherUFT,StrObjectClass,StrObjectProperty,StrObjectPropertyValue)
            'Example return one object:
            'CreateObjDes (Window("text:=Calculator"),"WinButton","text","9")).Click
            
            'Example for return a array objects
            'Set ObjButton= CreateObjDes (Window("text:=Calculator"),"WinButton","","")
            'ObjButton(0).Click
            Set ObjDesObject=Description.Create()
                ObjDesObject("micClass").value= StrObjectClass

            Set ObjDesObjectChild=ObjectFatherUFT.ChildObjects(ObjDesObject)

            Dim IntCiclo
                IntCiclo=0

            If strcomp(StrObjectProperty,"") <> 0 Then

                For IntCiclo=0 to ObjDesObjectChild.count -1
                    If strcomp(StrObjectPropertyValue, trim(ObjDesObjectChild(IntCiclo).GetROProperty(StrObjectProperty)))=0 Then
                    SET CreateObjDes= ObjDesObjectChild(IntCiclo)

                    End If
                Next            
            Else
                SET CreateObjDes= ObjDesObjectChild
                
            End If
        END FUNCTION
Reply


Messages In This Thread
RE: How to make a function for an object that has a large number of parent objects - by jacosta - 01-28-2014, 11:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing Object to Function Mozza 2 1,929 08-02-2018, 03:22 AM
Last Post: Mozza
  does WebTable Object provides a method to get column number umer830 4 13,047 07-06-2018, 09:32 AM
Last Post: vijaychourasiya0109@gmail.com
Question Is there a way to create dynamic objects by declaring the type of object as parameter lotos 3 2,238 11-08-2017, 11:15 PM
Last Post: lotos
  Problem with large webtable JoshS 0 1,827 08-26-2015, 04:04 AM
Last Post: JoshS
  QTP is not identifying Parent objects it self then how can we automate swapna.9n9 0 2,043 12-11-2014, 04:32 PM
Last Post: swapna.9n9

Forum Jump:


Users browsing this thread: 2 Guest(s)