UI自动化 - 基于多个标识符选择对象

kum*_*mar 4 microsoft-ui-automation

我是新来的.我正在使用UI Automation来自动化我的应用程序.有没有办法根据多个标识符识别元素.目前以下语法仅能够基于一个标识符进行识别.

AutomationElement okbtn = dialogbox.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "OK"));
Run Code Online (Sandbox Code Playgroud)

我想通过NameProperty和ControlTypeProperty获取标识元素.

这可能吗?

kum*_*mar 10

        Condition cMenuItem = new AndCondition(
            new PropertyCondition(AutomationElement.LocalizedControlTypeProperty,"text"),
            new PropertyCondition(AutomationElement.NameProperty,"Appointment"));

        AutomationElement aeMenuItem = aeTaskMenu.FindFirst(TreeScope.Descendants, cMenuItem);
Run Code Online (Sandbox Code Playgroud)