本文介绍了如何使用Coded UI(通用Windows)从UIA列表中选择项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 你好, 你能帮我从下面的Control中选择一个项目吗?使用Coded UI(因为它的Windows 10我无法使用Coded UI的记录和播放,我必须使用的通用Windows版本): 搜索属性: ControlType - List AutomationId - select_14 TechnologyName - UIA 通用属性: 友情名称 - 小时:2 有焦点 - 错误 Exists - True 启用 - 真 名称 - 小时:2 IsTopParent - False 高度 - 45 宽度 - 225 Top - 1071 左 - 3903 提前致谢, G 解决方案 取决于您将如何使用编码的UI测试构建器,我以计算器为例: 我要点击数字8,我可以使用Coded UI测试构建器获取其属性: 1)左边是将其添加到  UIMap然后生成代码(这很简单)时将使用的名称,然后单击该数字的代码将如下: Mouse.Click(this.UIMap.UICalculatorWindow.UIEightButton); 2)并且右侧属性用于handcodind,然后单击numbe r 8你需要先找到它: UITestControl 8 = new UITestControl(); eight.SearchProperties [XamlButton.PropertyNames.AutomationId] =" num8Button" ;; eight.SearchProperties [XamlButton.PropertyNames.ControlType] =" Button" ;; eight.SearchProperties [XamlButton.PropertyNames.TechnologyName] =" UIA"; 我建议您使用第一个来实现您的编码UI测试。   问候, Fletcher   Hi there,Can you please help me to select an item from the following Control using Coded UI (Since its Windows 10 I cannot use the record and playback of Coded UI, I have to use the Universal Windows version):Search Properties:ControlType - ListAutomationId - select_14TechnologyName - UIAGeneric Properties:Friendly Name - Hours: 2Has Focus - FalseExists - TrueEnabled - TrueName - Hours: 2IsTopParent - FalseHeight - 45Width - 225Top - 1071Left - 3903Thanks in advance,G 解决方案 Depend on how you will use the coded UI test builder, I take the calculator as an example:I'm going to click the number 8, and I could get its property using Coded UI test builder:1) the left side is the name that you will use when you add it to UIMap then generate code (which is simple), then the code to click the number will be like:Mouse.Click(this.UIMap.UICalculatorWindow.UIEightButton);2) and the right side properties are used for handcodind, then to click the number 8 you need find it first:UITestControl eight = new UITestControl(); eight.SearchProperties[XamlButton.PropertyNames.AutomationId] = "num8Button"; eight.SearchProperties[XamlButton.PropertyNames.ControlType] = "Button"; eight.SearchProperties[XamlButton.PropertyNames.TechnologyName] = "UIA";I will just recommend you use the first one to implement your coded UI testing. Regards,Fletcher  这篇关于如何使用Coded UI(通用Windows)从UIA列表中选择项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 16:40