Forum Discussion

motorola's avatar
motorola
Contributor
14 years ago

wait for a form to appear

I want testcomplete to wait for a maximum 10 seconds for a form to appear before moving on to the next step. if the form appears before 10 seconds, then immediately move to next step. if after 10 seconds pass and the form still haven't shown, log an error and abort the whole test. how do I do this with keyword test? thanks

2 Replies

  • Joseph,


    Each keyword-test operation has an Auto-Wait Timeout attribute. It specifies the number of milliseconds that TestComplete will wait for when the needed object is not found. So --

    * Add the "If Object" operation that will check whether the needed window is available to your test. The child operations of this operation will be executed after the window appears.

    * Change the "Auto-Wait Timeout" attribute of this If Object operation. You need to do this in the Auto-Wait Timeout column. It is hidden by default, so right-click the column area, select Field Chooser from the context menu, drag the column to the editor and enter the needed value.


    An alternative approach is to use the Call Object Method or Run Code Snippet operation to call the Sys.Process("YourApp").WaitWindow(...) method from your keyword test.


    You can also implement a waiting loop using the "While Loop" and "If Object" operations, but for me, this requires too many actions.


    You can watch the following video --

    http://support.smartbear.com/screencasts/testcomplete/waiting-for-objects/

    Or, read the following topic --

    http://support.smartbear.com/viewarticle/12168/.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    There is, in keyword tests, a statement you can add for "If Object".  Adding that Test action (see screenshot) will prompt you to select the object you wish to wait for (usually mapped in NameMapping or you can select it from what is currently on screen) and then select a property.  I would suggest, in your case, to use the "Exists" property in this If logic and, if the Exists is true, then proceed with the next step.



    This is equivalent to, for script code, the WaitAliasChild method.