Sys.Refresh() prevents Window object from being recognised as VCLObject
Hi,
The Delphi application I am testing starts with this flow:
Splash screen -> login screen -> main window.
The main window is represented as a Window object in the object browser and is available at launch. However it only gets recognised as a VCLObject once the login screen appears (~20 secs later on my machine). I've observed this behaviour both from launching the application manually and launching it as part of a test script using TestedApps.Run.
The issue is when I refresh the object tree programatically before the login screen appears, either using Sys.Refresh() or Process(..).Find with the refresh parameter set to true, the main Window object never gets recognised as a VCLObject.
However, if I pause test script execution and refresh the object tree manually in the Object Browser, the VCLObject sometimes appears. When it doesn't appear, I need to either highlight the window by right clicking the Window object and selecting "Highlight on screen", or by inspecting the window using the Object Spy. Refreshing the object tree after performing either of these actions causes the VCLObject to appear.
So my questions are:
- What can cause the Window object to take so long to be recognised as a VCLObject?
- Why does programatically refreshing the object tree cause the Window object to never be recognised as a VCLObject?
I am using TestComplete 11.31.2420.7 on Windows 7.
Any advice or help is appreciated. Thank you.
In re-reading your post, you're using the "Find" method and using the "Name" property of the object to find what you're looking for.
Name is not a recommended property to use, to be honest. A better way would be to examine the object and pick a set of properties that uniquely identify it. You can then pass them as arrays to the find object.