Forum Discussion

lowres's avatar
lowres
Occasional Contributor
7 days ago

....Preparing an object recognition hint....

Hello All,

I know its been covered a few times before but I can not find/understand the solution,

I am having performance issues using If Object on my WPF application, when the object I am looking for does not exists it spends ages doing "Preparing an object recognition hint".

I have a bunch of forms I have to click and validate. Some forms take special parameters selected from a pull down menu. But not all forms have the same selections. So I want to cycle through all the forms only changing the items that exist in that form.

For this I use If Object...
If an object exists,
      then change it to a variable.
Else Do the next thing.

This works if the object exists but if the object does not exist it takes ages on "Preparing an object recognition hint" I guess trying to find it or something similar in the app's large hierarchy?

It eventually finishes, it indeed does not find the item and goes onto the next part of the test. There are no errors and its doing what I expect, except for the long time it takes it to establish that the object does not exist (~2 minutes). Changing the timeouts/self healing does not seem to have any affect. 

The object I am checking is about 80 levels deep in the structure. Can I work round this some how, just look for the object I specify and not anywhere else? Surely the object is either there or its not there?



8 Replies

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    You’re correct: the object is either there or not. But TestComplete is designed to be “helpful” — it tries extended search strategies and visual recognition when objects are missing, which introduces delays. These steps are focused on disabling or avoiding those fallback behaviors.

    1. Set Operation‑Level Timeout
      Don’t change the global 10 s timeout. Instead, adjust the operation-specific timeout to something like 1s.
      👉 Set Auto‑Wait Timeout
    2. Disable Self‑Healing (if it’s turned on)
      While self-healing won’t stop recognition hints, it can add extra fallback work.
      👉 Self‑Healing Tests
    3. Use If…Then with WaitAliasChild() instead of IfObject
      IfObject may trigger deep fallback and hint generation. Using WaitAliasChild() (with a short timeout) is more direct and efficient.
      if (Aliases.MyForm.WaitAliasChild("ComboBox1", 1000).Exists) {
       Aliases.MyForm.ComboBox1.ClickItem("Option A"); 
      }
      
      This checks only the immediate alias-child, limiting unnecessary search.
    4. Disable Extended Find / Auto‑search Features in Name Mapping
      Prevent TestComplete from automatically expanding its search beyond the mapped path.
    5. Use WaitAliasChild() for Object Detection
      Rather than relying on full deep path resolution, dynamically wait for a child object via WaitAliasChild(), with a short timeout, which avoids deep fallback lookups.

    🔹 Create a Minimal Project for Testing (Diagnostic Step)

    To isolate the problem, try creating a new lightweight TestComplete project with:

    • Only essential NameMapping entries
    • A single test case using WaitAliasChild() logic

    This helps determine whether your current mapping or project structure is contributing to the slowdown.

    🤖 AI-assisted response
    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Imagine this scenario - you have two name-mapped objects in TestComplete - Object1, which is currently visible in the Object Browser (i.e. present in memory), and Object2, which is not visible (i.e. not in memory at the moment).

    When you run the check:

    if (Object1.Exists)

    TestComplete finds Object1 already in memory, so it can immediately access its properties (like .Exists, .Visible, etc.) and quickly return true.

    However, for:

    if (Object2.Exists)

    Since Object2 is not currently in memory, TestComplete doesn't immediately know whether it exists or not. So it enters a waiting state - controlled by the Auto-wait timeout setting (default: 10 seconds under Tools > Options > Playback > Runtime). During this time, TestComplete repeatedly tries to find Object2 in the application.

    This is the issue that you are facing. To resolve this issue use one of the WaitNNN methods. For example,

    var obj = object.WaitAliasChild("Object2", 1000); // Wait up to 1 seconds
    if (obj.Exists)
      ...

     

    • lowres's avatar
      lowres
      Occasional Contributor

      Im not sure thats what is going on.

      I am not looking for Object2, I am only looking for Object1.

      So I go to my form check if Object1 exists then I go to another form and check if Object1 exists etc etc.

      If Form 1 does not have the object it takes for ever to say so. Why would it have have object1 in memory since the form does not contain object1. 

      My Auto wait is 500ms..... why does it wait 2 minutes?

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        I was giving a brief description of how TestComplete works (and generally how programming works). Hence "Imagine this scenario".

        It's difficult to provide a possible solution without seeing the actual code, Object Browser and the UI objects you are trying to interact with.

         

  • lowres's avatar
    lowres
    Occasional Contributor

    Thanks Hassan & rraghvani,

    At higher levels in the hierarchy this works well, but as I get to the lower levels this still takes ages. Ill need to keep playing with it.

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      Without seeing the exact code, and the objects you are interacting with, as shown in the Object Browser, it's difficult to provide a possible solution that will work.

      • lowres's avatar
        lowres
        Occasional Contributor

        Yes I realize that too, Ill log a call if I can not figure it out. Pretty sure its just my inexperience.