Forum Discussion

DenisMedvedev's avatar
DenisMedvedev
Contributor
9 years ago

How to ‘Wait’ object ‘Right’?

We are using script tests and before working with element we are waiting element via it’s properties:

 

(obj.Exists == true && obj.VisibleOnScreen == true && obj.Visible == true && obj.Enabled == true)

In most cases it’s work, but sometimes we are getting error, something like ‘Testcomplete are not able to perform action with disabled element’ or warning ‘The action may be performed incorrectly, because the control is disabled.’

On the screenshots we see that window is opened, but our element is not displayed yet.

We use loops and “aqUtils.Delay(1000)” like workaround, but it’s hardcode and sometime doesn’t work.

So, question is how to deal with it?

 

I would be grateful for any help.

Thanks in advance

Denis

   

  • Montikore's avatar
    Montikore
    Occasional Contributor

    Hi,

     

    Did you try something like : Sys.WaitWindow("MyApp").Exists

     Or Sys.WaitProcess("myproc").Exists

    • DenisMedvedev's avatar
      DenisMedvedev
      Contributor

      yes, of course we did.
      we even checked that object Exists, VisibleOnScreen,Visible and Enabled but it didn't help

      • Montikore's avatar
        Montikore
        Occasional Contributor

        the thing is you can't do this on the object if the object does not exist. That's why you have to use the method Exists not on the object itself, but using the waiting metods waitwindow, waitproc...