Forum Discussion

oychw's avatar
oychw
Contributor
15 years ago

How to set the timeout of TestObj.Exists?

All:

  When I use following:

      if(Aliases.DCI.Exists)

              Aliases.DCI.frm_FormDci.close();



It always waiting until timeout. need 10 seconds by default. Can we reduce it to 1 second in scripts?

thanks!

3 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor
    Right click on project name, then Edit - Properties - Playback. Modify value in the field "Auto-wait timeout, ms" (1000 ms == 1 sec)

  • Hi,





    Checking the Exists property value of the object directly when the needed object has not been created can lead to the error in the test log. There is a more reliable way: use the WaitAliasChild method and check the existence of the object returned by the method. As a second parameter, you can pass the waiting time:







      var DCIProcess;

      DCIProcess = Aliases.WaitAliasChild("DCI", 1000);

      if (DCIProcess.Exists)

        DCIProcess.frm_FormDci.close();







    For more information, refer to the "WaitAliasChild Method" help topic.
  • All:

        thanks!

    Gennadiy:

        That shall effect all controls.

    Alex:



        That's a good idea.

        I use it this way:

            function close_All()                                                              

            {

              var DCIProcess;

              DCIProcess = Sys.WaitChild("Process(\"DCI\")",500);

              if (DCIProcess.Exists)

                DCIProcess.close();  

               

            }