Forum Discussion

simon_glet's avatar
simon_glet
Regular Contributor
11 years ago
Solved

WaitAliasChild raises an exception if child doesn't exist

Greetings, (using TC 9.2)





I am confused by the difference the documentation and the behavior of the function WaitAliasChild.



The documentation states:

"The child object that has the specified alias. If the specified object does not exist, the method returns a stub object and the method does not post an error message to the log, unlike when you directly refer to a mapped object by an alias. To determine whether the returned object exists in the system, use its Exists property."



And the result of myAlias.WaitAliasChild("NotThereAlias"):

An Error log message with the following message "The myAlias object does not have a child with the name "NotThereAlias".



What am I missing ? Is there a setting that changes that behavior ?



Thanks
  • Hi Simon



    If the alias name "NotThereAlias" does not exist in the name mapping then an error would be logged, unless you use the WaitChild method.

    No error will be logged if the alias name has been mapped but the object does not exist when running the test.

2 Replies

  • paul_scroce's avatar
    paul_scroce
    Frequent Contributor
    Hi Simon



    If the alias name "NotThereAlias" does not exist in the name mapping then an error would be logged, unless you use the WaitChild method.

    No error will be logged if the alias name has been mapped but the object does not exist when running the test.
  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Paul,



    I see ... The alias must exist ...



    FindChild is my new best friend ;-)



    Thanks !