Forum Discussion

sree2011's avatar
sree2011
Contributor
6 years ago

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 t...
  • RUDOLF_BOTHMA's avatar
    RUDOLF_BOTHMA
    6 years ago

    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