UWP 应用中的 AutomationElement
AutomationElement in UWP apps
我正在对 UWP 应用程序中的 UI 自动化进行一些实验,我想知道是否可以在 UWP 应用程序 (Getting a Handle to a button in another window) 中使用以下代码。
var hwnd = FindWindowByCaption((IntPtr)0, "App1");
AutomationElement lync = AutomationElement.FromHandle(hwnd);
AutomationElement optionsButton = lync.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "something"));
((InvokePattern)optionsButton.GetCurrentPattern(InvokePattern.Pattern)).Invoke();
如果我添加 "correct" 对我的 UWP 项目的引用
- UI自动化客户端
- UI自动化类型
我遇到以下错误。
Cannot find type System.SystemException in module CommonLanguageRuntimeLibrary.
我完全明白我不能这样做(添加对 UWP 项目的引用)。有没有其他可能的方法或者不可能?
UWP 模型中的应用沙盒意味着这是不可能的。
如果您有充分的理由需要这样做,请在 https://wpdev.uservoice.com/
上提出建议(说明您需要它的理由——它可以帮助您更有说服力)
我正在对 UWP 应用程序中的 UI 自动化进行一些实验,我想知道是否可以在 UWP 应用程序 (Getting a Handle to a button in another window) 中使用以下代码。
var hwnd = FindWindowByCaption((IntPtr)0, "App1");
AutomationElement lync = AutomationElement.FromHandle(hwnd);
AutomationElement optionsButton = lync.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "something"));
((InvokePattern)optionsButton.GetCurrentPattern(InvokePattern.Pattern)).Invoke();
如果我添加 "correct" 对我的 UWP 项目的引用
- UI自动化客户端
- UI自动化类型
我遇到以下错误。
Cannot find type System.SystemException in module CommonLanguageRuntimeLibrary.
我完全明白我不能这样做(添加对 UWP 项目的引用)。有没有其他可能的方法或者不可能?
UWP 模型中的应用沙盒意味着这是不可能的。
如果您有充分的理由需要这样做,请在 https://wpdev.uservoice.com/
上提出建议(说明您需要它的理由——它可以帮助您更有说服力)