I am working with Desktop application and I am trying to click on an object. I can click on the same object multiple times until I start receiving the error message: “There was an attempt to perform an action on a zero-sized window”. I have tried few things to resolve this issue but nothing works:
I have tried calling the Refresh method before clicking the object
I have tried putting a delay before clicking the object
I have checked the height and width of the object, it is not zero and is visible on screen
The only thing that work is when restart the application and try to click the same object, it doesn’t give me that error until I click the same object multiple times I start receiving the same error message again.
I thought you were right to try a delay. I did a quick community search and found 2 related solved issues. Could you post a code snip? Are you scripting or Keyword testing?
P.S. I would check Focusable, IsFocused, IsEnabled, Visible, VisibleOnScreen, IsVisible, Visibility. One of these is likely being toggled between click actions.
I am trying to click “TestComplete Work Area 1”, that’s when I see the error I reported. When I click “TestComplete Work Area 1”, the Dataset list on right side shows up.
I’m assuming the Datasets is not populated until the Work Areas item is selected first? If that is the case, then you need to wait for the child item Datasets object to exist, before proceeding to the next step.
If you use the Object Browser, you should be able to see the behaviour of how your object is created.
I’m using Browser App as an example - you have the following item .Panel(6).Panel(0).Button(“dropdownMenuButton”) which represents the button ‘Dropdown button’. However, the child item .Panel(6).Panel(0).Panel(0) does not exist yet (shown in red).
When you click on the button ‘Dropdown button’, the child item .Panel(6).Panel(0).Panel(0) is then created (shown in blue). You can then access the object afterwards.
Use the appropriate WaitNNN methods to wait for the child object to appear first.
Use VisibleOnScreen and Enabled Together along with Width and Height
if (obj.VisibleOnScreen && obj.Enabled && obj.Width > 0 && obj.Height > 0) {
obj.Click();
} else {
Log.Error("Object is not intractable at this time.");
}
// Set the option to "Capture images and test object info"
Options.Visualizer.CollectMode = vcmImg;
AI-assisted response. Found the answer helpful? Give it a Kudos by clicking Like! Got your issue resolved? Click Mark as Solution so others can find it quickly.
Since this is happening only on repeated click attempts I would log the related states of the WA object just prior to clicking the object to see if there are any differences between working and not. It may give you another useful error if it is unable to log the state of the object.
I would check Focusable, IsFocused, IsEnabled, Visible, VisibleOnScreen, IsVisible, Visibility. One of these is likely being toggled between click actions.
… Some of these states may not apply to your object and there may be others you can check I have not listed here. The delays seem to be needed in the solved cases to allow time for object state changes or creation.
if (WA.VisibleOnScreen && WA.Enabled && WA.Width > 0 && WA.Height > 0)
WA.Click();
else
Log.Error(“Object is not interactable at this time.”);
}
So at the time of clicking the object, the width and height is 0 and the property VisibleOnScreen is False, even though I can see the object on screen. After using Refresh method on the object multiple times, I can click the object. I tried using WaitProperty method as shown above in the code, but no use.
Originally posted by Hassan_Ballan on August 29, 2025
It looks like the object isn’t fully initialized when TestComplete tries to interact with it, even though it’s visually present. This is common with complex WinForms UIs.
Try using a polling loop with Refresh() and short delays, and also check parent container visibility. If the control is virtualized or delayed in rendering, this should help you synchronize interaction more reliably.
Also consider using WaitChild() or FindChild() to ensure dynamic readiness, and try SetFocus() before clicking.
// 1. Use WaitAliasChild or WaitChild Instead of Static Object References
var WA = Sys.Process("AXISEL")
.WinFormsObject("MainForm")
.WinFormsObject("splitContainer1")
.WinFormsObject("SplitterPanel", "", 1)
.WinFormsObject("NavigationBar")
.WinFormsObject("WorkAreaView")
.WinFormsObject("TV")
.WaitChild("OutlineItem", 5000);
if (WA.Exists) {
WA.Refresh();
Delay(1000);
// ...
}
// 2. Loop Until the Object Is Interactable
var maxTries = 10;
var success = false;
for (var i = 0; i < maxTries; i++) {
WA.Refresh();
Delay(500);
if (WA.VisibleOnScreen && WA.Enabled && WA.Width > 0 && WA.Height > 0) {
success = true;
break;
}
}
if (success)
WA.Click();
else
Log.Error("Object is still not interactable after multiple attempts.");
// 3. Check for Parent Container Visibility
var container = Sys.Process("AXISEL")
.WinFormsObject("MainForm")
.WinFormsObject("splitContainer1")
.WinFormsObject("SplitterPanel", "", 1)
.WinFormsObject("NavigationBar");
Log.Message("Container visibility: " + container.VisibleOnScreen);
// 4. Use SetFocus() Before Interaction
WA.SetFocus();
Delay(500);
WA.Click();
In some WinForms apps (especially with custom or third-party controls), elements like tree views use virtualization — meaning TestComplete sees the node only when it’s scrolled into view or selected.
You might need to scroll or expand parent nodes, and use keyboard navigation if mouse-based visibility fails.
Yep, good thought. I too have seen instances where the state of the parent object affects the accessibility of the child objects. I have had drop downs built like this where they were embedded in a TreeView or other such odd or complex object. The parent would lose focus and game over.
A screen shot of the object tree section you are working with may be helpful. Expand it out to the child object you are trying to work with and include any relevant details of the objects.
I once had to deal with an object that was a TextBlock until it was clicked on. Then it became a TextBox I could add data in. The manual GUI tests were fine but TC had to be coded to click the ‘Block’ and wait for the ‘Box’ A super big pain to discover and code around.
Originally posted by rraghvani on September 02, 2025
hina have you tried using the appropriate WaitNNN methods to wait for the child objectto to be created?
From what your have mentioned with regards to property values, it seems like your object is not created. Therefore, you can not check the property values yet.
This object is always visible physically, as you can see in the screenshot the object is visible but still the Height and Width is 0. I am also including the screenshot of the object browser after restarting the application, where Height and Width is not 0 and I am able to click the object:
Originally posted by Hassan_Ballan on September 02, 2025
Notice also the ControlIndex and ControlIndexGroup are “-1”. It looks like the UI element is being destroyed and never properly recreated, or Memory corruption or rendering issues.
What happens when you try code refresh, or Object Browser panel GUI refresh
Sys.Refresh(); // Refresh process list
Sys.Process("MyApp").Refresh(); // Refresh UI tree inside app