CefSharp 窗口的 UI 自动化不可能
我正在尝试使 CefSharp 窗口可以通过 MS UI 自动化工具(例如spectr.exe 或 UISpy)进行访问。 默认情况下,CefSharp 窗口被视为图像,并且 UI 属性不可访问。
我已经设置了命令行参数“force-renderer-accessibility”。它本身没有改变任何东西,但后来我添加了这段代码:
browser.AccessibilityHandler = new AccessibilityHandler(browser);
browser.IsBrowserInitializedChanged += (sender, args) =>
{
if ((bool)args.NewValue)
{
browser.GetBrowserHost().SetAccessibilityState(CefState.Enabled);
}
};
它部分起作用,我可以访问大多数控件,但其中一些控件仍然无法访问(它们被 UISpy 称为“组”,你不能作为树节点更深入地遍历它们)。扫描还发现一些物品偏离其真实位置。
有没有更好的方法让 CefSharp WPF 窗口可供 UI 自动化工具使用?我做错了什么吗?
我正在使用 CefSharp 97.1.12
I'm trying to make CefSharp window accessible with MS UI Automation tools like inspect.exe or UISpy.
By default the CefSharp windows is treated by these as an image and the UI properties are inaccessible.
I've set the commandline argument "force-renderer-accessibility". Itself it didn't change anything, but then I added this code:
browser.AccessibilityHandler = new AccessibilityHandler(browser);
browser.IsBrowserInitializedChanged += (sender, args) =>
{
if ((bool)args.NewValue)
{
browser.GetBrowserHost().SetAccessibilityState(CefState.Enabled);
}
};
It partially worked, I can access most of the controls, but some of them are still inaccessible (they are referred to by UISpy as 'group' and you can't traverse them deeper as tree nodes). Also the scan finds some items a bit away from their real position.
Is there a better way to make CefSharp WPF window available to UI automation tools? Is there something I'm doing wrong?
I'm using CefSharp 97.1.12
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论