错误:无法在编码的ui测试中找到选定的控件 [英] Error: Unable to locate the selected control in coded ui test

查看:122
本文介绍了错误:无法在编码的ui测试中找到选定的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个选项卡的Windows应用程序.在测试期间,我需要检查一个选项卡下的复选框.

I have a windows application that contains multiple tab. There are check boxes under one tab which I need to check during my test.

我通过启动应用程序然后逐个进入包含复选框的最后一个选项卡,然后关闭应用程序来记录测试.除了选中复选框之外,一切运行正常.

I recorded the test by launching the application and then going one by one to the last tab that contains the check boxes and then closed the application. Everything run fine except selecting the check boxes. 

它给了我一个例外,说明该 

It gave me an exception stating that the 

"

"

我尝试从UIMap定位该控件,但出现错误,提示无法找到该控件.

I tried to locate the control from UIMap but got error saying that the control cannot be located.

在通过编码ui测试搜索控件时,似乎未考虑出现在包含复选框的选项卡下的控件.

It seems like control that appears under the tab which contains check boxes are not considered during the search of control by coded ui test.

如何在已编码的ui测试中启用搜索复选框?

How do I enable the search for check boxes in my coded ui test?

我正在使用Visual Studio 2015.

I am using visual studio 2015.

推荐答案

您好ganravhim,

Hi ganravhim,

感谢您的信息.

能否请您告诉我您的复选框的类型是什么?是第三方控制吗?

Could you please tell me what's the type of your checkbox? Is that a third party control?

据我所知,Code UI测试支持成功记录正常复选框.

As far as I know, Code UI test support to record the normal checkbox successfully.

因此,请首先确保找到控件.您可以使用DrawHilight()来控制是否存在.

例如:UIFormWindowCtrl.DrawHighlight();

此外,您也可以尝试使用控件在控件上添加断言 span>键盘快捷键(Ctrl + I),然后检查是否可以捕获它.

Also you can try to add assertion on the control using keyboard shortcuts (Ctrl + I) and check whether you could capture it.

如果可以成功捕获它.我建议您可以重新记录测试,然后再试一次.

If you can capture it successfully. I suggest you could rerecord your test then try it again.

如果无法捕获复选框控件.我想默认在Code UI测试中不支持此控件.

If you can't capture the checkbox control. I suppose this control is not supported by default in Code UI test.

此外,还请使用FindMatchingControls().计数,检查您的应用程序中是否有一些相同的控件.

In addition, Please also use the FindMatchingControls().Count, check whether there are some same controls in your app.

如果存在与复选框具有相同搜索属性的控件.我建议您可以更改此复选框控件的另一个搜索属性,然后重试.

If exist the control which has the same search property to the checkbox. I suggest you could change another search property of this checkbox control then try it again.

在这种情况下,t o enable Windows窗体应用程序中的第三方控件,您需要添加引用 和代码.有关更多信息,请参见下面的链接:

In this case, to enable third party controls in Windows Forms applications, you need add references and code. For more information, see link below:

https ://msdn.microsoft.com/zh-CN/library/hh552522(v = vs.120).aspx

希望对您有所帮助.

最好的问候,

肖湖


这篇关于错误:无法在编码的ui测试中找到选定的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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