Forum Discussion
The error indicates that the object wasn't ready for interaction at the time the action was attempted. The test log often includes a screenshot, which can provide helpful visual context on the state of the UI at the failure point. https://support.smartbear.com/testcomplete/docs/testing-with/running/handling-errors/searching-for-cause.html
Here are a few targeted suggestions:
- 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.");
}
You can also configure https://support.smartbear.com/testcomplete/docs/working-with/managing-projects/properties/visualizer.html or https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/misc/options/index.html Visualizer to capture object info
// 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.
Hi Hassan,
Thank you for you reply. I tried the following code as you suggested:
function test2()
{
var WA = Sys["Process"]("AXISEL")["WinFormsObject"]("MainForm")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "", 1)["WinFormsObject"]("NavigationBar")["WinFormsObject"]("WorkAreaView")["WinFormsObject"]("TV")["OutlineItem"]("TestComplete Work Area 1*");
WA["Refresh"]();
Delay(1000);
Log["Event"](WA.VisibleOnScreen);
Log["Event"](WA.Enabled);
Log["Event"](WA.Width);
Log["Event"](WA.Height);
WA["WaitProperty"]("VisibleOnScreen","True",2000);
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.
- Hassan_Ballan4 months ago
Champion Level 3
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.
- scot19674 months ago
Champion Level 3
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.
- scot19674 months ago
Champion Level 3
... Would this be "Thinking outside of the box"? π