Ankit Tewari
Ankit Tewari

Reputation: 70

How can I wait for a window to close and than perform any operation in QTP?

I want to perform a operation after a window is closed, i.e Suppose I have a window or any dialog popped up and now I want my code to wait until this particular dialog get closed and after that I want to code continue.

Means I want to wait till that window is opened without using hardcoded 'Wait()' function.

Is there any method in VBScript or QTP that fulfills my needs?

Upvotes: 1

Views: 2836

Answers (1)

HgCoder
HgCoder

Reputation: 1243

You could try the 'WaitProperty' method on your window to determine when visible property becomes false, but that might throw an error once the window is no longer available. Otherwise, you can always loop until it no longer exists

While Window("My Window").Exist(0)
    Wait 0, 500 ' Pause briefly before looking again
Wend

Upvotes: 2

Related Questions