Forum Discussion

mikeb_1's avatar
mikeb_1
New Contributor
15 years ago

Timing and temporary dialogs

Hi,



I'm trying to script a test whereby a button is clicked and a progress dialog is displayed for a minimum of two seconds.

I want to check in the script that the dialog is on screen for at least two seconds.



I am having trouble getting TC to recognize fast enough that the progress dialog exists.

Seemingly, by the time it gets round to looking, the dialog has already been opened and closed.



Is there any way to speed up the script or clever (quick) method to check for existence of the dialog such that I could calculate an approximate display time?



thanks



Mike

3 Replies

  • Hello Mike,




    Try using the Sys.Desktop.ActiveWindow property to get the dialog with a progress bar. You can do this in a loop to get a rough estimation of the time the dialog is there.

  • mikeb_1's avatar
    mikeb_1
    New Contributor
    Thanks for the reply.



    I've tried using Sys.Desktop.ActiveWindow, however, I got similar results as previously.



    The progress dialog I am trying to pick up should be displayed for a minimum of  2 seconds, however, if a large file is being processed it will display for longer.



    In the 2 second example Sys.Desktop.ActiveWindow only seems to pick up the parent window and not the progress dialog.



    In the example where it is processing for longer (and the progress dialog is displayed for longer) Sys.Desktop.ActiveWindow will pick up the progress dialog and I am able to calculate the display time.



    Repeatedly logging the return value from Sys.Desktop.ActiveWindow.Name after clicking the button shows that script is being executed quick enough to pick up the progress dialog (i.e. well within 2s of clicking the button) it just doesn't seem to realise that the progress dialog is there.



    Thanks



    Mike





  • Hello Mike,




    I guess, the progress dialog opens after your test executes a click in your application.

    Try replacing the Click call with the MouseDown + MouseUp calls. The point here is that the Click method's logic performs some checks to make sure that the application received the click, and this logic may take some time. At that, the MouseDown and MouseUp calls do not perform this check, so, this may help you accomplish your task. Please note that you will probably need to put a small delay between the calls.

    I hope this helps.