Hello,
From time to time I get strange tests failture reports on wait for ajax.
I'm using a code from this forum:
It works great but from time to time exception is thrown and I get false alerts on application status:
Here is stack trace for the exception:
Any idea how to prevent it?
I could use try / catch block but I don't like this solution because I would'n get info when something really wrong happens to my application.
I'm using Telerik Test Studio version 2011.2.928.0
Bartosz
From time to time I get strange tests failture reports on wait for ajax.
I'm using a code from this forum:
[CodedStep(
"Wait for AJAX"
)]
public
void
AjaxWait()
{
Wait.For<
int
>(c => ActiveAjaxConnections() == 0, 0, 120000);
}
public
int
ActiveAjaxConnections()
{
return
Actions.InvokeScript<
int
>(
"jQuery.active"
);
}
It works great but from time to time exception is thrown and I get false alerts on application status:
Here is stack trace for the exception:
System.ApplicationException: Exception thrown during the wait for a condition. Error: Unexpected error while waiting on condition. Error: ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
System.InvalidOperationException: Javascript call [JSON.stringify(eval(\"jQuery.active\"));] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: TypeError: 'jQuery' is undefined
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document) BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunctionReturnJSON',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'jQuery.active',ClientId:'Client_e44e8a42-9bf5-4df0-940f-bae9ef9c4df0',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [JSON.stringify(eval(\"jQuery.active\"));] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: TypeError: 'jQuery' is undefined
at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
at ArtOfTest.WebAii.Core.Actions.InvokeScript[T](String script)
at ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions.InvokeScript[T](String script)
Any idea how to prevent it?
I could use try / catch block but I don't like this solution because I would'n get info when something really wrong happens to my application.
I'm using Telerik Test Studio version 2011.2.928.0
Bartosz