Ask a Question

Solution for changing full name of an object

SOLVED
DKumar04
Contributor

Solution for changing full name of an object

Sys.Process("YYY").WPFObject("HwndSource: ControlRoot").WPFObject("ControlRoot").WPFObject("DockPanel", "", 1).WPFObject("mainGrid").WPFObject("MenuControlHost").WPFObject("Control_ROOT").WPFObject("Grid", "", 1).WPFObject("Grid", "", 1).WPFObject("ContentControl", "", 1).WPFObject("WeldPortInspectionControl", "", 1).WPFObject("Border", "", 1).WPFObject("Grid", "", 1).WPFObject("TabControlWithCornerElement", "", 1).Click(1635,38)

 

In the above full the number in the part (WPFObject("TabControlWithCornerElement", "", 1)) keeps changing at runtime or playback. how to handle this? 

7 REPLIES 7
tristaanogre
Esteemed Contributor

This is where NameMapping comes in with object identification.  You cannot control that number yourself, that's an index depending upon other factors within the AUT.

However, with NameMapping, you can target other properties of the component (class, caption, and many more) to uniquely identify object for use in your testing.

 

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/inde...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
TanyaYatskovska
SmartBear Alumni (Retired)

Hi @DKumar04,

 

Did you have a chance to investigate the Name Mapping feature? Did it help you resolve the issue?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



I am not interested in it, as it was not very helpful for my project

TanyaYatskovska
SmartBear Alumni (Retired)

What are the requirements for your project?

Perhaps, we can suggest an alternative solution.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



tristaanogre
Esteemed Contributor


@DKumar04 wrote:

I am not interested in it, as it was not very helpful for my project


Suffice it to say, you'll need to find some alternative way of identifying the object.  The index value CAN and WILL change for application components so you should find some means of identifying the object that utilizes multiple properties.  FindChild might work for you (https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findch...) or something similar.

However.... I'm not sure how "NameMapping" is not helpful for your project.  Can you clarify as to what need is not being met by NameMapping?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
dmiscannon
Frequent Contributor

"In the above full the number in the part (WPFObject("TabControlWithCornerElement", "", 1)) keeps changing at runtime or playback. how to handle this? " If just the number is changing, replace the number with * which is a wild card to handle situations like this.


@dmiscannon wrote:
 If just the number is changing, replace the number with * which is a wild card to handle situations like this.

 

Normally, I'd suggest this, but that doesn't guarentee that you'll get the CORRECT object.  If there's more than one, differentiated only by the index, then using the wildcard will return an ambiguous object recognition warning and, potentially, have the automation fail because the correct object could not be accessed.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: