Search code examples
vbscriptqtp

in QTP, how to check whether a dialog is already open?


I have been using the following code to check whether a dialog is already open

If  Window(window_name).Dialog(dialog_name).Exist = False 
    Then '' //here qtp waits..
    Window(window_name).WinMenu("Menu").Select menu_name
End If

This code is to avoid reopening the same dialog during each run of the code. But the qtp run waits about 10 - 15 seconds & then goes to next step. in what way we can avoid this?

If the dialog is not open, then the menu will be clicked to open the dialog.


Solution

  • The Exist property accepts a value of how long to wait for the object to exist.

    If Window(window_name).Dialog(dialog_name).Exist(60) = False