通过 System.Windows.Automation 在 Chrome 中访问 Silverlight 窗口
这可能是徒劳的,但我想知道是否有人有这样做的经验。
我正在尝试使用 System.Windows.Automation(例如,AutomationElement)访问 Google Chrome 中托管的 Silverlight 应用程序em>)。
我遇到的问题是 Chrome 在子进程中托管 Silverlight 应用程序。如果我尝试查找“Silverlight Control” AutomationElement(通过使用主进程的 hWnd),则会失败。
如果我找到 Silverlight 主机子进程,它没有窗口句柄,并且如果我尝试使用子进程的句柄查找控件,则会失败。
我知道它在那里...我可以使用 检查
但我只能通过在 Silverlight 中单击来找到它应用程序并在 Inspect 中向上导航。我无法使用 AutomationElement.FindFirst 或 Inspect 从选项卡窗口向下导航。
就像窗口和 Silverlight 插件之间存在脱节一样,这在 IE 或 Firefox 中是看不到的,我不知道如何解决它。
还有其他人能够做到这一点吗?
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
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这对您的实例是否有帮助,但我遇到了几个需要启用从外部到 Silverlight 的通信的实例(需要与 Silverlight 应用程序通信的 Office 应用程序加载项)。我在托管 Silverlight 应用程序的 html 页面中使用了 javascript 作为该通信的桥梁:
如果我可以提供任何其他信息,请告诉我。希望这对您有一些用处。
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:
If there any additional information I can provide please let me know. Hope this is of some use to you.