Forum Discussion

manish_bansal_1's avatar
manish_bansal_1
Occasional Contributor
10 years ago
Solved

Waiting for window till a given time

As we all know TC does not support a very important feature of timeout with exists function,  Smartbear telling us to use some WaitNNN  method, :catfrustrated: but again without exists i am not sure ...
  • AlexKaras's avatar
    AlexKaras
    9 years ago

    Hi,

     

    The difference between, for example, .Window() and .WaitWindow() is that .Window() searches for the window for the AutoWait timeout and posts a message to the log if the window was not found. You should consider this function as a kind of implicit checkpoint - i.e. if the window must be present and you reference it via the call to .Window(), you will be notified if the window did not exist without any additional actions from your side.

    .WaitWindow() searches for the window for the specified timeout (for example, you may specify zero wait time in order not to wait for the window but just to check whether it exists or not) and does not post anything to the log. Then it is your responsibility to decide what to do if the window was found or not as it is only you who knows whether or not window is expected to exist or not. So no reason to post something into the log if the window was not found because it well might be that I want to check that some window does not exist. And in this case my code will be like this:

    If (obj.WaitWindow().Exists) Then

      Log.Error("Window that must be absent exists")

    End If

    ...