Forum Discussion

OV's avatar
OV
Frequent Contributor
7 years ago

Dynamically created objects with same name

Hi,

 

In my script I'm creating dynamically few objects. these objects are being created as child objects of existing objects.

 

Now, during the script i need to verify that these child objects were created properly under the right parents.

My problem is that TC identify them as the same object no matter where they were created or if they were created at all.

 

For example, if i have 3 parents and i'll create only 1 child the log will say all parents has child created under them.

how do i solve this issue.

 

In the attached, Quick Design1 (. ) is the parent and the child object created dynamically  under it is Printer

Same for  Quick Design2 (. ). if i'll run the script now TC's log will tell me that there's a child name Printer also under  Quick Design3 (. ) which is not true.

 

I can't add these object in advanced to the NameMapping as these child objects will be created dynamically with probably random names.

 

Second problem, The Printer object in the breadscrumb tree (top right hand side) in the attached file identified by TC as the same object as the Printer child object who's under any of the parents. how do I distinguish between them? again, they are all being created dynamically so i can't add them in advanced to the NameMapping,  they have no Unique ID or property.

So, this code:

 

function AddPrinter(Device)
{
// Verify Printer item exists under each device
if(Aliases.QuickDesign_ConfigurationManager.BreadsScrumpTree.FunctionalItemsControl.Border.TextblockPrinter.Visible)
Pass(Aliases.QuickDesign_ConfigurationManager.BreadsScrumpTree.FunctionalItemsControl.Border.TextblockPrinter.WPFControlText + " was added properly under " + Device)
else
Fail(Aliases.QuickDesign_ConfigurationManager.BreadsScrumpTree.FunctionalItemsControl.Border.TextblockPrinter.WPFControlText + " wasn't added properly under " + Device)
}

 

Will indicate that all 3 parents has the child object Printer under them which is of course wrong as the 3rd one - Quick Design3 (. ) doesn't.

 

see attached to understand more.

 

How do I solve this problem?

 

Thank you,

No RepliesBe the first to reply