CodedUI : PropertyNames.ControlName doesn't work

喜你入骨 提交于 2019-12-11 12:14:24

问题


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.

WinGroup group = new WinGroup(this.window); group.SearchProperties.Add(WinGroup.PropertyNames.Name, strGroupName, PropertyExpressionOperator.Contains); group.SearchConfigurations.Add(SearchConfiguration.NextSibling);

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


回答1:


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");




回答2:


ControlId is not a searchable property anyway. CodedUI is just about the most useless POS I've ever seen.



来源:https://stackoverflow.com/questions/36056249/codedui-propertynames-controlname-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!