We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
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?
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.
if (Aliases.MyForm.WaitAliasChild("ComboBox1", 1000).Exists) {
Aliases.MyForm.ComboBox1.ClickItem("Option A");
}
This checks only the immediate alias-child, limiting unnecessary search.To isolate the problem, try creating a new lightweight TestComplete project with:
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
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 https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-activation.html#WaitMethods methods. For example,
var obj = object.WaitAliasChild("Object2", 1000); // Wait up to 1 seconds
if (obj.Exists)
...
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?
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.
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.
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.
Yes I realize that too, Ill log a call if I can not figure it out. Pretty sure its just my inexperience.