I am currently testing in a .net application which has long polling request. In my application, there are several Ajax request which are triggered in parallel, each Ajax loads a different part of the page. I need to wait till every required Ajax request gets complete. I tired various options of a TruClient action end event, but only wait till document loaded was helpful to make my script run successfully without waiting for these Ajax request.
We made a custom JS code to wait for these Ajax request, but unfortunately the code works well in Selenium but using the same code in TruClient, throws "JavaScript Memory Error". This error occurs most of the time but the script was succeeded once or twice out of ten iteration.
Can you please help me with this or suggest any other possible solutions?
A Sample JS script which we tried to wait for page load,
var State = document.readyState();
while(State!="complete")
State=document.readyState();