cancel
Showing results for 
Search instead for 
Did you mean: 

Solution for changing full name of an object

SOLVED
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? 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Solution for changing full name of an object


@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
[Community Expert Group]
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

View solution in original post

7 REPLIES 7
Community Hero

Re: Solution for changing full name of an object

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
[Community Expert Group]
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
Community Manager

Re: Solution for changing full name of an object

Hi @DKumar04,

 

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

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Solution for changing full name of an object

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

Community Manager

Re: Solution for changing full name of an object

What are the requirements for your project?

Perhaps, we can suggest an alternative solution.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Community Hero

Re: Solution for changing full name of an object


@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
[Community Expert Group]
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
Frequent Contributor

Re: Solution for changing full name of an object

"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.
Community Hero

Re: Solution for changing full name of an object


@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
[Community Expert Group]
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

View solution in original post