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.