Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help in creating dynamic object string using Childobjects
#1
Not Solved
Hello,

I am working on a keyword driven uft framework where I am writing the test case flow in the excel sheet which is being processed by functions in the function library. The format of the excel has the following columns. 

1. Parent(Example Value - "Browser, Page") - All parent objects are to be put in a single cell separated by comma
2. Parent Properties(Example Value - micclass:=Browser, title:=login,micclass:=Page) - All parent properties are to be put in a single cell separated by comma
3. Control (Example Value - WebEdit) - Contrl  object is the object on which the operation/action is to be performed.
4. Control Properties - Contains all the control object properties used to identify control object.
5. Action - Contains the action to be performed (ex SetValue, Click) on the control object.
6. Argument - Contains the Argument to be passed to the action (eg String argument passed to set value of a textbox etc)

I have created a ParenthierarchyIdentifier which creates a parenthierarchy object in the below format:

Browser(“B”).Page(“P”).Frame(“F”).WebEdit(“W”).Set “some value”

I am trying to do this using ChildObjects but I am getting the "Object doesn't support this property or method: 'obj_hierarchy(...).ChildObjects'" error.

Function Logic -  
1. Loop through each object until end of loop.
2. Create a description object for parent.
3. If Description_Object is the first object : Set obj_hierarchy = Description Object
       else
            Set obj_hierarchy = obj_hierarchy(0). Description Object
Next Iteration.
4. Call the ControlIdentifier() function.

The error I am getting is on step 3 else part when I am trying to fetch the child objects present under the parent hierarchy that i am at.

Below is the function code that i am executing. I have tried debugging using msgboxes and the logic is working fine but the code fails on the ChildObjects() statement.

'parentCount= for looping through each parent, arrparent = array containin parent names, sParentProp = parent property array, 

For i = 0 to parentCount
  msgbox arrParent(i)
        'Split Parent Property so that multiple objects can be resolved
        arrParentProp = Split(sParentProp, ",")
        parentPropCount = uBound(arrParentProp)
        msgbox parentPropCount
       
        Set current_parent = Description.Create()

For j = restart to parentPropCount
       
        arrParentpropKeyValue = Split(arrParentProp(j), ":=")
        msgbox arrParentpropKeyValue(0)
        msgbox arrParentpropKeyValue(1)
        If j<>restart and arrParentpropKeyValue(0) = "micclass" then
        restart=j
        msgbox "Exiting Loop"
        Exit For
Else
msgbox "In else loop"
        current_parent(arrParentpropKeyValue(0)).value = arrParentpropKeyValue(1)
        End If
        Next


If i=0 Then
Set obj_hierarchy = current_parent
msgbox "Done"
Else
msgbox "Concatenating"
*Set obj_hierarchy = obj_hierarchy(0).ChildObjects(current_parent)  
End If

Next

*Error on this statement = Object doesn't support this property or method: 'obj_hierarchy(...).ChildObjects'



Your help would be highly appreciated,

Thanks and Regards,
Keshub
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Is there a way to create dynamic objects by declaring the type of object as parameter lotos 3 1,936 11-08-2017, 11:15 PM
Last Post: lotos
  HAVING PROBLEM IN CREATING OBJECT OF TEST BATCH RUNNER mayankchauhan 0 3,302 04-04-2014, 05:29 PM
Last Post: mayankchauhan
  childObjects not working sometimes hadar 0 1,775 07-30-2013, 12:04 AM
Last Post: hadar
  Creating a folder from within a reusable action. sd3 2 2,943 06-18-2013, 03:20 PM
Last Post: learnQtptips
  Adding a Visual ID - creating a function jcraig26 0 2,430 11-09-2012, 02:56 AM
Last Post: jcraig26

Forum Jump:


Users browsing this thread: 1 Guest(s)