Forum Discussion

tziconsult's avatar
tziconsult
Occasional Contributor
7 years ago

Problems with the EXISTS method in TestComplete V9

I had some issues with the EXISTS method in terms of dealing with modal lists of an application (test object). Somehow the EXISTS method may not deliver the correct information, whether the object is...
  • tristaanogre's avatar
    7 years ago

    Your problem is in the following line

     

    While (Aliases.za.wndSelect.Exists)

     

    The Exists property MAY work fine for this in some situations... but it will generally fail.  The reason being is actually logically simple: you cannot check the "Exists" property of an object that doesn't exist... you must have an object to have the "Exists" property.  Usiing Aliases works best because some of that is taken care of within the NameMapping engine.

     

    The best way to check the existance of an object you've already demonstrated in your code: Use a "Wait" method of some sort.  So, I would actually change your line of code to something like this.

     

    While (Aliases.za.WaitAliasChild("wndSelect", 10000).Exists)

     

    Reference the following help topic.

    https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html#checking-whether-an-object-exists-from-scripts