What does WaitForAjax() do?

3 posts, 1 answers
  1. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 21 Mar 2013 Link to this post

    Hi,

    Can you tell me what is the difference between the Method WaitForAjax() and this snippet:

    browser.Manager.Wait.For (c =>
           browser.Actions.InvokeScript<bool> ("Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()") == false, false, timeout);

    I always thought that WaitForAjax() should do the same, but there are situations where it doesn´t wait (long enough) but this snippet does.

    Kind regards
    Silvio
  2. Answer
    Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 22 Mar 2013 Link to this post

    Hello Silvio,

    You are absolutely correct - the WaitForAjax method executes pretty much the same script. There are only two differences:

    1. WaitForAjax() will not throw JS error ('Sys' is undefined) in case of non-MS Ajax page.
    2. WaitForAjax() also detect the jQuery AJAX requests.

    My only guess is the page under test isn't consistent in the AJAX post backs, thus the behavior you notice.

    Regards,
    Konstantin Petkov
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 22 Mar 2013 Link to this post

    Thanks for your answer!

    Kind regards
Back to Top