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

ApplicationNotReadyException

1 Answer 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Arooj
Top achievements
Rank 1
Arooj asked on 12 Sep 2011, 05:57 PM
Hi,

I have a silverlight 4 webpart in sharepoint 2010. I'm trying to access it with Telerik testing framework. I'm using the following code.
Settings mySettings = new Settings(new Settings.WebSettings(BrowserType.InternetExplorer));
 mySettings.Web.EnableSilverlight = true;           
 
Manager myManager = new Manager(mySettings);
myManager.Start();
 
myManager.LaunchNewBrowser();
AddDialogSupport(myManager);
 
Thread.Sleep(mySettings.Web.SilverlightConnectTimeout);
 
var slApp = myManager.ActiveBrowser.SilverlightApps()[0];            \\ this is where i get the error
 
myManager.Dispose();

 

I'm getting the following exception when i execute the Manager.ActiveBrowser.SilverlightApps()[0] line.

ApplicationNotReadyException.
Error checking HTML access on SilverlightApp.

ExecuteCommand failed!
InError set by the client. Client Error:

System.InvalidOperationException: Javascript call [document.getElementsByTagName(\\'object\\')[0].settings.enableHtmlAccess] failed!
Please make the function exists and the call is using the correct prototype signature. Javascript error: Error

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:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'document.getElementsByTagName(\\'object\\')[0].settings.enableHtmlAccess',ClientId:'Client_da180eb3-8a78-4d51-8186-125cdf273e97',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'System.InvalidOperationException: Javascript call [document.getElementsByTagName(\\'object\\')[0].settings.enableHtmlAccess] failed! Please make the function exists and the call is using the correct prototype signature. Javascript error: Error
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.


Any help would be appreciated.
Thanks.
Best Regards,
Arooj

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 14 Sep 2011, 08:43 PM
Hello Arooj,

Basically the error message is trying to say that it could not find the Silverlight application on the web page. There are a couple of possible reasons for this:

1) The browser did not navigate to the right page with your Navigate call
2) The Silverlight application is actually contained inside an <iframe> element. If this is the case you need to access the frame first then the app like this:

var slApp = myManager.ActiveBrowser.Frames[0].SilverlightApps()[0];

That is assumeing Frames[0] is the correct frame. It could be Frames[1] or 2. Depends on which frame the Silverlight application was placed on. By looking at the HTML source you should be able to discover which one is the right one.

Greetings,
Cody
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Arooj
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or