4

This is probably futile, but I'm wondering if anyone out there has experience doing this.

I'm trying to access a Silverlight application hosted within Google Chrome by using System.Windows.Automation (e.g., AutomationElement).

The problem I'm having is that Chrome hosts the Silverlight app within a child process. If I attempt to find the "Silverlight Control" AutomationElement (by using the main process' hWnd), it fails.

If I locate the Silverlight host child process, it does not have a window handle, and if I attempt to find the control using the child process' Handle it fails.

I know it's there... I can see it using Inspect

Jerkface

but I can only find this by clicking in the Silverlight app and navigating up in Inspect. I cannot navigate down from the tab window using AutomationElement.FindFirst or Inspect.

Its like there is a disconnect between the window and the Silverlight plugin that isn't seen in IE or Firefox, and I don't know how to get around it.

Has anybody else been able to do this?

  • Does [running Chrome with the `--no-sandbox` flag set](http://www.screenr.com/fda) help? I don't have Inspect.exe available to me so am unable to confirm. – Marcel Apr 12 '11 at 12:20
  • @Marcel: Hmmm, dunno. I'm not sure if that is an acceptable solution, however. You have to ask users to not use one of Chrome's better features. Its kinda like asking them to run as administrator. –  Apr 12 '11 at 12:47
  • Oh for sure, I thought you were just trying to debug something which this answer would be suitable for. – Marcel Apr 12 '11 at 12:49

1 Answers1

1

I'm not sure if this helps or not in your instance but I've run into a couple instances where I needed to enable communication into Silverlight from outside (Office Application AddIns that need to communicate with the Silverlight Application). I've used javascript in the html page hosting the Silverlight Application as a bridge for that communication:

    function sendToNav(message) {
        var nav = document.getElementById("Nav");
        nav.content.NavigationPage.HandleScriptedMessage(message);
    }

    function passMessageToHost(message) {
        if (window.external == null) return;

        window.external.HandleScriptedMessage(message);
    }

If there any additional information I can provide please let me know. Hope this is of some use to you.

Casey Margell
  • 224
  • 2
  • 12
  • Thanks for the suggestion, but unfortunately I don't control the page in which the application resides. –  May 04 '11 at 18:13