I’ve been using TestComplete (primarily Javascript) for over a year now but I never managed to figure out how to get the raw Alias value from a stub object.
The context:
I have a generic search field object with the following Alias: Aliases.Application.SearchFieldAs it takes a while for the field to render I want to use WaitAliasChild to wait for the search field to appear. However the function processing the search field can also be applied to a different screen where the search field is defined as Aliases.Application.Screen1.SearchField. There are a dozen more similar Aliasses pointing to SearchFields I want to process with the same function. Therefore I’m passing the target Alias as a parameter to the function.
Ideally I would want to use the Alias parameter and call .MappedName. Then snip up the string into smaller bits and call WaitAliasChild for each snippet. For example calling the function with an Alias of Aliases.Application.Screen1.SearchField would then result in Aliases.Application.WaitAliasChild(‘Screen1’).WaitAliasChild(‘SearchField’). Perfect!
However, since the object is not yet on screen the Alias parameter only carries a stub object. Alias.MappedName does not work as stubs only contain the .Exists parameter.
So my question is: is there a way to get the MappedName parameter from a stub object?
The oddest thing is that calling aqObject.CheckProperty on the Alias will throw an error which contains the actual MappedName. So I’m sure it is accessible somehow:
*Unable to find the following object when executing the aqObject.CheckProperty command:*Aliases.Application.SearchField
I have been thinking about listing all Aliases as strings in the codebase and evaluating them when needed as objects but this will sever all ties to the actual Aliases library and is much more prone to typo’s.
A Stub object is like an “empty” object with minimal properties/methods, just enough to simulate the real object’s behaviour. It may not have the mapped name - you can verify this via debugging and viewing the actual contents of the Object.
Yeah, that’s correct. The stub object only has the .Exists property. Still, somewhere in the system should be a reference to the Alias (Aliases.Application.SearchField in this case) cause how else would the system know this particular object does not exist. And how is it listed in the Unable to find the following objectlogging? And I’m wondering what I need to do to find it. In essence I just want to know which Alias I’m processing
One thing for sure you must wait for the object before retrieving mapping info. Always call .WaitProperty(“Exists”, true, timeout) on the alias first—otherwise the child may not yet be registered in the mapping table. Than use WaitAliasChild before interacting with a child object.
Found the answer helpful? Give it a Like! Got your issue resolved? Mark it as the solution so others can find it fast.
If TestObj exists it will contain a path you can return and use as a string and then concatenate ChildName to produce the path you are looking for. The stub object can’t contain the path to something it can’t find but you can log what you asked it to find. Am I over simplifying the issue (missing something)? Let me know.
var parent = Aliases.App;
var childName = "MainWindow";
var child = parent.WaitAliasChild(childName, 5000);
if (!child.Exists) {
Log.Warning("Object not found. Attempted alias path: " + parent.FullName + "." + childName);
} else {
Log.Message("Object found: " + child.FullName);
}
I hope this helps!
… If you find my posts helpful drop me a like! Be sure to mark or post the solution to help others out and/or to credit the one who helped you.
Well, the thing is that the function I’m using gets the Alias as a parameter. Therefore I don’t know the parent without calling Alias.Parent. Neither do I know childName for the same reason. I want to pick it from the Alias using Alias.MappedName but I need for the object to Exists before I can do that. And in order to use parent.WaitAliasChild(childName) I need the MappedName. Thus I’m running in circles. If I could get the MappedName from the stub object (which is based on an Alias being exactly what I need) then I could identify the Parent and childName.
I think the stub object should contain *{Exists: false, MappedName: Aliases.Application.SearchField, FullName: Sys.ApplicationName.Yada.Yada.Yada.SearchField}*A little code example of the problem: *test(Aliases.Application.Screen1.SearchField)
test(Aliases.Application.Screen2.SearchField)
function test (Alias) {
Aliases.Application.???.WaitAliasChild(‘SearcField’)
}*
But isn’t that odd? Since the framework uses the Alias and FullName to check if the object exists in the first place.
I think the stub object should contain
*{
Exists: false,
MappedName: Aliases.Application.SearchField,
FullName: Sys.ApplicationName.Yada.Yada.Yada.SearchField
}*Or there should be some other way to fetch the pointer from an Alias-defined non-existent object.
A little code example of the problem: *test(Aliases.Application.Screen1.SearchField)
test(Aliases.Application.Screen2.SearchField)
function test (Alias) {
Aliases.Application.???.WaitAliasChild(‘SearcField’)
}*
How do I identify the Parent? Assuming there can be many input Aliases in this function
Based on your example code - as an example, you can do this
function test()
{
// Assuming Aliases.Application.Screen1/2 object exists.
search(Aliases.Application.Screen1);
search(Aliases.Application.Screen2);
}
function search(obj)
{
// Use the WaitAliasChild method to delay the test execution until the object specified
// by its alias appears in the system or until the specified time limit is reached
if (obj.WaitAliasChild("SearchField", 30000).Exists) {
Log.Message("Found child 'SearchField'.")
} else {
Log.Warning("Did not find child 'SearchField' within the specified time period.")
}
}
The parent object is Aliases.Application.Screen1, and you are waiting for the child object SearchField to appear within the 30 second time period.
This would be a new feature. Have you dropped an idea in the Feature Requests forum? If you don’t think there is a way to do this other than through the returned stub object this would be the best action. You could also reach out to support.
Feature Request:
TestComplete Feature Requests | SmartBear Community
I hope you find an answer to this soon! Don’t forget to mark a best answer to complete this issue when you think you have one and drop a few likes for the comments. We would really appreciate it!
Originally posted by Hassan_Ballan on August 01, 2025
TestComplete does not provide a built-in way to retrieve the .MappedName or full alias path from a stub object. Stub objects are placeholders created by TestComplete (for example, via Utils.CreateStubObject() or when using methods like WaitAliasChild() before the actual UI element exists). These stub objects only expose limited properties—primarily .Exists—and any attempt to access other properties or methods like .MappedName will raise exceptions, since the underlying UI object is not available yet.
To keep your logic dynamic and avoid needing .MappedName from a stub, a reliable workaround is to use string paths instead of alias objects. For example, pass the alias path as a string (e.g., “Application.Screen1.SearchField”) into your function, then dynamically resolve it by splitting the string and calling WaitAliasChild() step-by-step, like this:
function waitForAliasPath(aliasPathStr) {
var parts = aliasPathStr.split('.');
var current = Aliases;
for (var i = 0; i < parts.length; i++) {
current = current.WaitAliasChild(parts[i], 10000); // waits up to 10 seconds for each part
}
return current;
}
// Usage
var searchField = waitForAliasPath("Application.Screen1.SearchField");
This approach avoids direct dependency on .MappedName and works consistently even when the UI object is not yet rendered.
Note: While this method is effective, it breaks direct ties to the Aliases tree in your code, so you lose IntelliSense/auto-complete support and increase the risk of typos. Also, be aware that using string-based dynamic evaluation requires careful handling to avoid maintenance or security issues.
Lastly, attempts to extract alias paths from error messages (such as those thrown by aqObject.CheckProperty) are considered fragile hacks and are not recommended for production code.
Originally posted by mdehaan on September 19, 2025
I submitted the Feature Request: https://community.smartbear.com/idea/testxcompletefeaturerequests/access-alias-path-information-from-stub-objects-in-testcomplete/278191