如何使用Coded UI(通用Windows)从UIA列表中选择项目 [英] How to select an item from a UIA list using Coded UI (Universal Windows)
问题描述
你好,
你能帮我从下面的Control中选择一个项目吗?使用Coded UI(因为它的Windows 10我无法使用Coded UI的记录和播放,我必须使用
的通用Windows版本):
搜索属性:
ControlType - List
AutomationId - select_14
< p style ="margin:0in 0in 12pt"> 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 - List
AutomationId - select_14
TechnologyName - UIA
Generic Properties:
Friendly Name - Hours: 2
Has Focus - False
Exists - True
Enabled - True
Name - Hours: 2
IsTopParent - False
Height - 45
Width - 225
Top - 1071
Left - 3903
Thanks 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列表中选择项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!