b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

【视频教程】使用UIAutomation开发软件外挂(2)

电脑杂谈  发布时间:2016-05-21 07:06:44  来源:网络整理

AutomationElement desktop = AutomationElement.RootElement; var calcFrame1 = desktop.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.ClassNameProperty, "CalcFrame")); ClickCalcButton(calcFrame1, "3"); ClickCalcButton(calcFrame1, "6"); ClickCalcButton(calcFrame1, "5"); ClickCalcButton(calcFrame1, "*"); ClickCalcButton(calcFrame1, "1"); ClickCalcButton(calcFrame1, "2"); ClickCalcButton(calcFrame1, "=");

其中ClickCalcButton是我封装的一个方法:

private static void InvokeButton(AutomationElement e) { InvokePattern invoke = (InvokePattern)e.GetCurrentPattern(InvokePattern.Pattern); invoke.Invoke(); } private static void ClickCalcButton(AutomationElement calcFrame1, string name) { Condition conditionBtnPlus = new AndCondition( new PropertyCondition(AutomationElement.ClassNameProperty, "Button"), new PropertyCondition(AutomationElement.NameProperty, name) ); var btn = calcFrame1.FindFirst(TreeScope.Descendants, conditionBtnPlus); if (btn == null) { throw new Exception("找不到名字为"+name+"的计算器按钮"); } InvokeButton(btn); }

文章篇幅有限,特别是对于一些没有Win32基础的朋友,光看上面的文字会不太容易懂,因此我录制了一套大约90分的视频教程,详细的讲解了uiautomation的使用,希望能够帮到大家。

视频教程地址如下

以上就是关于uiautomation的全部内容,相信你一定会非常满意。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-5733-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...