首页 > 编程知识 正文

手游获取ui元素,移动ui界面的基础元素

时间:2023-05-06 12:37:43 阅读:58353 作者:1172

UIAutomtion主要使用AutomationElement类来表示UI自动化目录树中的UI自动化元素,其中包含UI自动化客户端APP应用程序用作标识符的值。

添加ui自动(向参考中添加UIAutomationClient、UIAutomationTypes、UIAutomationProvider和uiautomationclientsideproviders )。

(只有Donet 3.0以上的项目才有)

如何识别窗口。 首先启动calc.exe。

using system .诊断程序; using System.Windows.Automation;在void GetCalc () Process的Handle中使用automationelementprocess ) []p=process.getprocessesbyname ) ) calc ' ); automationelementcalcwindows=automation element.from handle (p [0].main window handle ); }

还有一个办法

using System.Windows.Automation;识别void GetCalc ()//桌面后, 桌面上窗口类型且名称为“Calculator”的automationelementrootelement=automation element.roo telent automationelementcalcwindows . Children,newandcondition ) newpropertycondition ) automent ControlType.Window ),newpropertycondition (自动元件}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。