Won't Fix
Last Updated: 16 Aug 2016 08:16 by ADMIN
ADMIN
Ivaylo
Created on: 18 Mar 2016 12:12
Type: Feature Request
2
Exception when trying to deserilize large JS objects
Error when trying to deserialize large JS RAD object using Invoke JS Browser function.



In order to reproduce execute the test in the attached project.



The exception thrown is:



Error Message:
ArtOfTest.WebAii.Exceptions.ExecuteCommandException : ExecuteCommand failed!
InError set by the client. Client Error:
System.InvalidOperationException: Javascript call [JSON.stringify(eval(\"$(\\\'#ctl00_MainHeaderControl_TelerikLogoImage\\\')\"));] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: TypeError: Object expected 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunctionReturnJSON',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'$(\\\'#ctl00_MainHeaderControl_TelerikLogoImage\\\')',ClientId:'Client_d5694d3f-84a9-4f4c-94be-3201f1e1be48',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [JSON.stringify(eval(\"$(\\\'#ctl00_MainHeaderControl_TelerikLogoImage\\\')\"));] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: TypeError: Object expected 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
Exception Message:
ArtOfTest.WebAii.Exceptions.ExecuteCommandException : ExecuteCommand failed!
InError set by the client. Client Error:
System.InvalidOperationException: Javascript call [JSON.stringify(eval(\"$(\\\'#ctl00_MainHeaderControl_TelerikLogoImage\\\')\"));] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: TypeError: Object expected 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunctionReturnJSON',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'$(\\\'#ctl00_MainHeaderControl_TelerikLogoImage\\\')',ClientId:'Client_d5694d3f-84a9-4f4c-94be-3201f1e1be48',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [JSON.stringify(eval(\"$(\\\'#ctl00_MainHeaderControl_TelerikLogoImage\\\')\"));] failed! Please make sure the function exists and the call is using the correct prototype signature. Javascript error: TypeError: Object expected 
   at ArtOfTest.InternetExplorer.IECommandProcessor.InvokeFunction(String functionCall, Boolean useEval, Boolean returnJSON, IHTMLDocument2 doc)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessActionCommands(BrowserCommand request)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommandInternal(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.
Stacktrace:
 at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
 at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
 at ArtOfTest.WebAii.Core.Actions.InvokeScript[T](String script)
 at TelerikSample.Test.RunTest() in C:\Users\ittodorov\Desktop\work files\18.03.2016\TelerikSample-2\TelerikSample\TelerikSample\Class1.cs:line 37
Output:
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
1 comment
ADMIN
Ivaylo
Posted on: 12 Aug 2016 08:28
We have investigated this further and it turns out the problem is related to the internal usage in TestStudio of the JSON.stringify() function which does not support circular objects and the jQuery objects are circular.  Currently we can provide you with the following workaround as we will not be able to fix this immediately: 

You can use a JS function which extracts the required properties from the jQuery object and and attaches them to another object which is returned instead like in the provided example:

var res = myManager.ActiveBrowser.Actions.InvokeScript<jqObject>("(function(){var jqObject = $telerik.$('#ctl00_ContentPlaceholder1_RadMenu1'); var objectToReturn = {jquery:jqObject.jquery, length: jqObject.length, selector: jqObject.selector}; return objectToReturn;})()");

Please note that your code uses jQuery from "$" variable but on http://demos.telerik.com/aspnet-ajax/menu/examples/functionality/overlay/defaultcs.aspx jQuery is reassigned to "$telerik.$" variable.