How to know if a page with Ajax has fully loaded, using Javascript?

I am using Selenium RC with Java to automate pages which have ajax elements and i want to calculate the time it takes for the page to fully load.
I've tried         selenium.waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount == 0;", DEFAULT_WAIT_PERIOD);
but it returns as undefined. It doesn't help that i don't know the Javascript library that my page is using. The above line works for Prototype. I've tried the equivalent for JQuery and Dojo, but no luck.
Is there a way for me to track how many XMLHttpRequests went out and how many came back?
Who is Participating?
The info is in the readyState attribute of the XMLHttpRequest object used.

Most of time we use a callback function, for example with jQuery :

$.get("path/to/url.ext", function() {
  // callback part

Open in new window

Else we use a synchrone ajax call
Thanks for the points!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.