编码的UI测试看不到列表框元素 [英] Coded UI Test not seeing Listbox elements

查看:64
本文介绍了编码的UI测试看不到列表框元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个应用程序,该应用程序具有一个列表框,该列表框将ItemsSource绑定到静态资源.我的编码方式与我所读过的有关该主题的一些问题/答案相同,基本上是这样的:

I have an application that has a Listbox with the ItemsSource being binded to a Static Resource. I don't have it coded the same was as some of the question/answers on this topic that I have read about, here is what it basically is: 

<Listbox x:Name="myBox"
    AutomationProperties.AutomationID="MyBoxID"
    ItemsSource="{Binding Source={StaticResource list}}"
    SelectedValue={Binding SelectFirst}" >
<!-- some commented out styles for the listbox -->
</Listbox>

如您所见,我没有网格或将自动化ID绑定到每个列表框元素的任何方法,是否还有另一种方法可以使它们对已编码的ui可见?

as you can see i don't have a grid or anything to tie automation id's to each of the listbox elements, is there another way to make them visible to coded ui? 

推荐答案

编码后的用户界面可以按(名称,ID,InnerText,/DisplayName/FriendlyName,ClassName,ControlDefinition等)搜索html控件. 这些值具有更多的唯一性,可以更轻松,更快地找到它们.只需确保您至少拥有一个在每个控件上面 它们很容易识别.

Coded UI can search html controls by (Name, ID, InnerText,/DisplayName/FriendlyName, ClassName, ControlDefinition etc.  more unique those values are easier and faster to find. Just make sure you have at least one of the above in each control to make them easily identifiable.


这篇关于编码的UI测试看不到列表框元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆