This is a migrated thread and some comments may be shown as answers.

What does WaitForAjax() do?

2 Answers 279 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Silvio
Top achievements
Rank 1
Silvio asked on 21 Mar 2013, 12:26 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Petkov
Telerik team
answered on 22 Mar 2013, 07:47 AM
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
0
Silvio
Top achievements
Rank 1
answered on 22 Mar 2013, 09:08 AM
Thanks for your answer!

Kind regards
Tags
General Discussions
Asked by
Silvio
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Silvio
Top achievements
Rank 1
Share this question
or