Forum Discussion

xuanphuoc2411's avatar
xuanphuoc2411
Occasional Contributor
8 years ago

WaitProperty always return false when using with "Exists" property and timeout = 0

Hi all,

 

I'm using "WaitProperty" action with "Exists" property and timeout = 0 to know control is exist or not immediately. However, TestCompelete always return false when we let timeout = 0 although "Exists" property of control is true.

 

My script:

 

  this.btn = Aliases.browser.pageLogin.formLogin.btnLogin
Log.Message("Get property Exists :" + this.btn.Exists) Log.Message("Get property Left :" + this.btn.Left) Log.Message("Get property Enabled :" + this.btn.Enabled) Log.Message("Wait property Exists:" + this.btn.WaitProperty("Exists", true, 0)) Log.Message("Wait property Left :" + this.btn.WaitProperty("Left", 609, 0)) Log.Message("Wait property Enabled :" + this.btn.WaitProperty("Enabled", true, 0))

Resuult

 

Test Compelete version 12.30.1651.7

 

Who can help me determine this issue. Thanks.

  • shankar_r's avatar
    shankar_r
    Community Hero

    What happens when you set the Timeout other-then 0 like 100 or 500?

    • xuanphuoc2411's avatar
      xuanphuoc2411
      Occasional Contributor

      Hi Shankar,

       

      This does not happen when I set the time out to other values (E.g time out = 100). However, action will take a few seconds before returning "false" when this control does not appear. Value of auto-wait timeout setting is also 100.

       

      Below are results when I set time out = 100

       

       

      Thanks.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        That is to be expected.  If it takes more than 100ms for the object's property to change from "false" to "true" then the WaitProperty method will return false.  That's the purpose of the time out... to give a maximum amount of time to wait for the object property to return "true".

         

        To be honest, when it comes to testing "Existance", I don't think "WaitProperty" is the best method.  To call the "WaitProperty" method on an object that does not exist doesn't make sense... and object needs to exist to call a method on it.

         

        Better solution to test existance of an object... WaitNNN method on the parent object...  

         

        parent.WaitChild('childobject', 10000) will wait 10 seconds to see if child object returns... if it returns, the result of the function is the object itself.  If it does not, the result of the function is a "stub" object with an Exists property set to the value of "false".