Forum Discussion

jthompson1's avatar
jthompson1
Contributor
3 years ago
Solved

Does anyone have good examples of the user of Wait in keyword testing

I keep trying to implement the Wait property instead of using delay as our websites response times are all over the place and my tests keep failing because an object was not available yet. I was attempting to use documentation and I have so far been failing at the implementation of this method. It seems it doesn't apply to all types and I was wondering if there is just a really easy example and explanation that someone with experience could drop here. I am not doing scripting of any kind but rather the operations you drag and drop into keyword tests. I often times try to apply Wait to an object and it just stalls in the playback and doesn't execute at all. I feel like mastering this is of great importance as I can't keep having my tests fail based on timing issues. Anyways any response or help would be great thanks. 

  • Hi,

     

    Generally speaking, with most of modern web applications, one must wait three times:

    -- First, test code must wait until the requested page is obtained from the server. This is what .Wait() method in TestComplete is for;

    -- Then, test code must wait until the received web page markup is processed by the browser, until browser downloads all required additional libraries specified in page script code, until browser executes initial script code and renders the page. In a nutshell - on this second wait test code must wait until the target control appears on the screen. (Note, code must first wait for control itself and only then can wait for some property value of this control -- there is no reason to wait for the property of control that does not exist) This is what .WaitXXX() methods in TestComplete are for;

    -- Then, in some cases, test code must additionally wait until the target control is populated with data and becomes ready to interact with end-user.

     

    Two last waits does not have any special support in TestComplete and must be implemented in test code as the actual implementation of these waits depends on the tested web page.

     

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Generally speaking, with most of modern web applications, one must wait three times:

    -- First, test code must wait until the requested page is obtained from the server. This is what .Wait() method in TestComplete is for;

    -- Then, test code must wait until the received web page markup is processed by the browser, until browser downloads all required additional libraries specified in page script code, until browser executes initial script code and renders the page. In a nutshell - on this second wait test code must wait until the target control appears on the screen. (Note, code must first wait for control itself and only then can wait for some property value of this control -- there is no reason to wait for the property of control that does not exist) This is what .WaitXXX() methods in TestComplete are for;

    -- Then, in some cases, test code must additionally wait until the target control is populated with data and becomes ready to interact with end-user.

     

    Two last waits does not have any special support in TestComplete and must be implemented in test code as the actual implementation of these waits depends on the tested web page.

     

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    If the documentation is not helping you, then give us a screenshot of your code that is failing.  Tell us what you expected to happen and what actually happened and we can help you from there.

    • jthompson1's avatar
      jthompson1
      Contributor

      Using On Screen Action, method WaitProperty. 

      Parameters entered for method.

      First Name Input field I am targeting. I am trying to wait for it to load. I thought i was targeting the property by name and the value of the property but perhaps I am missing something. It causes test to fail because object cannot be found.