本文介绍了CodedUI:PropertyNames.ControlName不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以一种通用的方式搜索自定义控件,因此我可以重复使用该函数来查找与此匹配的其他自定义控件。





它有一个名称和一个ControlName。



当我在下面的代码中查找customcontrol时,他将找到并执行请求的内容。



动作。

当我将PropertyNames更改为ControlName时,他会没有找到控件!这也让我感到惊讶,因为它也很独特。



这可能是什么原因?我错过了什么还是做错了什么?



为了安全起见,可以使用PropertyNames.ControlName查找对象吗?



致谢,
Leslie

解决方案

问题有早已发布,但我猜答案可能仍然与某人有关。



我建议尝试以下代码:



group.SearchProperties.Add( ControlName, NameOfYourControlNameProperty);


I'm searching for a customcontrol in a generic way, so I can re-use the function to find other customcontrols that match this one.

Screenshot of the properties

It has a Name and a ControlName. The name property will not always be filled in correctly, the ControlName will be!

When I look for the customcontrol like in the code below, he will locate and perform the requested actions.

When I change the PropertyNames to ControlName, he will not locate the control! Which completely surprises me, because it is also unique.

What can be the cause of this? Am I missing something or am I doing something wrong?

Just to be safe, can PropertyNames.ControlName be used to find objects?

Regards, Leslie

解决方案

The question has been posted quite a bit of time ago, but I guess the answer may still be relevant to someone.

I'd suggest trying the following code:

group.SearchProperties.Add("ControlName", "NameOfYourControlNameProperty");

这篇关于CodedUI:PropertyNames.ControlName不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 02:10