Ask a Question

Unable to find element - relative solution

SOLVED
Kate
Contributor

Unable to find element - relative solution

I face a problem that TestComplete stops seeing elements it interacted before. If I map them again they appears under another node of app structure. After some time TestComplete stops seeing them again and I need to re-map them again.

I would understand if that happened with new versions, but it happens even within one and the same version. 

 

Any suggestions? What can be the problem about?

Is there any way to map desktop app elements that will not depend on code structure? 

My developer says, he can add id to all elements. But I could not find any id-related methods for desktop apps.

That would help me a lot...

 

Thanks

 

 

11 REPLIES 11
NisHera
Valued Contributor

Are you auto mapping?

Then there is chance of  TC mapping  for unstable property.

Better to study what properties are stable not subject to change and using those, map manually.

Even in new version (of either TC or your application) you do not have to re-map

 

first check with dev's that your application compiled correctly as seen hear

then investigate your object with object spy more info

ask dev's what properties are stable 

map object manually like this 

as you said "developer  can add id to all elements" that is the best

Those id's will show in  object spy or in mapping property dialog (observe available properties in right hand side) if properly done.

 

p.s.

 

Also be careful about the hierarchy of objects For eg if you map an object top of hierarchy and then maps bottom object separately there could be problems (not in every case)

Eg You map object A as X

Then Map object B (which is child of A)   as Y

Then make sure Y define as child of X in mapping

 

 

tristaanogre
Esteemed Contributor

100% with @NisHera on the suggestions. Desktop applications CAN have their objects change dynamically... it depends a lot on how the items are constructed, rendered, etc., A good example would be a window that opens up where the caption on the window contains the current date and time.  If you are mapping the window and using the caption as part of the mapping criteria, every time you open that window, it would need to be remapped.

 

Auto mapping is a good start, but most of the time, you will need to go back and make sure either wildcards are added for variable values or, preferrably, more stable identifying factors are presented. 

 


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

Thanks for your replies.

 

It looks like I have mapped the elements manually...

I will try to use IDs.

 

Happy Holidays!

m_essaid
Valued Contributor

hi,

 

you need to map wisely. you musn't use handle numbers, instances numbers, or such ids that change every time the application launches.

you should use generic properties of your objects (don't hesitate to show the full list of properties in the object spy).

for example, if you have a message box. if you are sure that there is only one message box only. you could the just use its windows class to map it.

if you have 2 message box. (I don't know, I don't know your script) and maybe you need to distinguish them in the mapping. Then you could use 2 properties : windows class and caption. if the caption changes obviously.

Currently we decided to go ahead with AutomationIDs using object browser and Find method.

 

my_control = Sys.Process(my process name).Find('AutomationId', automation_id, 100000, True)

 

That seems to be fine finally.

Thanks everyone

Guys,

need help!

 

I made an install repair for TestComplete and it probably definitely removed some of my settings. 

I remember I somehow prioritized something for working with Object Browser as a default (preferred) way of mapping objects.

But I do not remember WHAT and WHERE.

 

I was not able to find that via search...

 

Share please

tristaanogre
Esteemed Contributor

That would be, I believe, under Tools | Options | Panels | Object Browser.


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

And?.... What should I do there?

 

I remember I moved smth to the top of the list ... Hopefully, I do not mess up with another settings...

But I do not see any lists there.

 

tristaanogre
Esteemed Contributor

I don't know EXACTLY what you did... but I think, based upon what you're telling me, you want to use the Custom option under category order and then click the Customize button to re-order your list.


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: