cancel
Showing results for 
Search instead for 
Did you mean: 

Object Identification Issue

SOLVED
Contributor

Object Identification Issue

I have created multiple automation scripts suites for a WPF application using Test Complete 12.41 version. All the suites run perfectly in my machine and all the machines in my environment. When we try to execute the same scripts in the client environment, all the suites except one suite will not run properly. The suite which is having issue will run properly for some time (probably 5 - 10 minutes) and after some time, it is not able to identify the objects properly and most of the steps are getting failed due to this. Client enviornment uses Virtual Machines for script execution. Could you please suggest on what could be the reason for the same.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Leader

Re: Object Identification Issue

Hi @sree2011 

 

In the majority of instances, the problems are related to object recognition issues.  Either because the object you are looking for by name doesn't exist due to, say, a mapped object's mapping properties not matching up to the actual value on the page, the object isn't ready, or, although it is mapped correctly, the object isn't actually there yet.  This is something quite common in Async/AJAX environments.  TC can't distinguish that the object isn't ready yet, just that it can't find it.

 

It is possible that because of the speed the tests run at on you machine is quicker - perhaps because it's running on a local versus remote machine - the control is ready on your machine in the alloted time, but not on your remote machine.

 

A few general strategies:

  • Add a Delay() in before you try and get the object.  I'm personally not a big fan of putting in Delays unless completely neccessary - rather use WAIT methods.
  • Increase your auto-wait timeout ([current/default] Project->properties->playback).  If TC finds the object before the Auto-wait timeout it continues, so setting this high won't affect your test speeds unless it genuinely can't find objects - at which point you may want to investigate why you have the issues in the first place
  • Before trying to use object.WAITxxx first do an existence check ( object.Exists) and only continue if it returns true
  • If it doesn't exists, you may want to consider waiting for a short while for your application to finish up then do a RefreshMapping() and/or RefreshMappingInfo() of your object's parent and try finding the original object again

-------------------------------------------------
Standard syntax disclaimers apply
Regards,
7 REPLIES 7
Community Hero

Re: Object Identification Issue

It would be helpful to see the error messages that are coming up, specifically the Additional Info tab.  Also, anything you can give us on how the objects are mapped/identified.


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
Extensions available
Contributor

Re: Object Identification Issue

Hi Robert Martin,

 

Thank you for you reply. I have attached two mht file here which will provide you with more details. the file which is named as "tcResults1_Error" is the log file generated from the machine where it got issue. The other file is from my machine where it works fine. Please let me know if this help you in any way. We are using descripting programming and directly accessing the objects through code and there is no mapping done.

 

Thanks & Regards,

Sreekanth

 

 

Contributor

Re: Object Identification Issue

Sorry i forgot to attach the second file which is the log file from my machine which works fine. Attaching the same here.

Community Leader

Re: Object Identification Issue

I notice that the WPFObject you are trying to find isn't called the same on the two machines (e.g. the use of *): WPFObjectClient: Client: ("HwndSource: EngagementHost", "Engagement:Template-5_7_2019_10_25_33_AM"). and

Local: WPFObject("HwndSource: EngagementHost", "Engagement:*Template-07_05_2019_09_18_24")"

 

What is your method of mapping/finding them ? Also, I notice that one appears to be using US date (m_d_yyyy) format while the other is using another - probably UK (dd_mm_yyyy) ?  This could mean that TC identification methods will find the one in your main machine's date format, but not on the client machine.  Is it an option to change the datetime format on the client machine just to check?

 

They look to be dynamic though.

 

Also *Template will be more successfull at finding objects in your instance, since it picks up everything that ends with Template.  Perhaps a mapping of [...Template-*] would be more accurate to cope with different dates ?


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Contributor

Re: Object Identification Issue

Hi Rudolf Bothma,

 

Thank you for your reply. These dates are genereted dynamically and we are using a variable to store the "Template*" value and this variable is being used across the scripts everywhere. I will verify the "*" missing in the client machine. Is there any other possibility for objects are not getting recognized. Please advise.

 

Thanks & Regards,

Sreekanth

Community Leader

Re: Object Identification Issue

Hi @sree2011 

 

In the majority of instances, the problems are related to object recognition issues.  Either because the object you are looking for by name doesn't exist due to, say, a mapped object's mapping properties not matching up to the actual value on the page, the object isn't ready, or, although it is mapped correctly, the object isn't actually there yet.  This is something quite common in Async/AJAX environments.  TC can't distinguish that the object isn't ready yet, just that it can't find it.

 

It is possible that because of the speed the tests run at on you machine is quicker - perhaps because it's running on a local versus remote machine - the control is ready on your machine in the alloted time, but not on your remote machine.

 

A few general strategies:

  • Add a Delay() in before you try and get the object.  I'm personally not a big fan of putting in Delays unless completely neccessary - rather use WAIT methods.
  • Increase your auto-wait timeout ([current/default] Project->properties->playback).  If TC finds the object before the Auto-wait timeout it continues, so setting this high won't affect your test speeds unless it genuinely can't find objects - at which point you may want to investigate why you have the issues in the first place
  • Before trying to use object.WAITxxx first do an existence check ( object.Exists) and only continue if it returns true
  • If it doesn't exists, you may want to consider waiting for a short while for your application to finish up then do a RefreshMapping() and/or RefreshMappingInfo() of your object's parent and try finding the original object again

-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Contributor

Re: Object Identification Issue

Hi Rudolf Bothma,

 

Thank you for the detailed response and i will have a try on the suggestions you had mentioned.

 

Thanks & Regards,

Sreekanth

New Here?
Join us and watch the welcome video:
Join the September Hub-bub to show off, learn and win