菜单控件问题 [英] Issue with Menu control
问题描述
大家好
我再次遇到了WindowsApplication中使用的菜单问题。
I again ran into trouble with my menus used in WindowsApplication.
场景 -
我的两个子菜单有相同的文字i。; e "RunTimeCustomization"。在播放时,UICoder会感到困惑,在打开时会无法识别。
Two of my sub-menus have identical text i.;e 'RunTimeCustomization'. While playback, UICoder gets confused and fails to recognise while one to open.
如果必须在第五级打开父菜单的子菜单,则播放控制将向上移动它之后,而不是点击它,控制移回到具有相同"子菜单"的第三级菜单。
As in if it has to open sub-menu of Parent menu at fifth level, then at playback control will move upto it and after that instead of clicking on it, control moves back to third level menu which has same 'submenu'.
这导致打开不正确的表单,我的脚本失败。很奇怪。当我更改子菜单的文本时,没有观察到这样的问题。
This results in opening of incorrect form and my script fails. Wierd it is. When I changed text of sub menus, no such issue issue was observed.
任何原因或解决方法,以防万一我不想更改不同级别的文本和相同的子菜单。
Any reason or workaround for this just in case i dont want to change the text and same sub menus at different levels.
谢谢和问候
Palak
推荐答案
是否有任何具体原因要有相同的菜单名称?编码的UI测试在大多数时间处理重复控件,例如按钮,文本框等。对于菜单项不做同样的操作是故意的,因为我们不希望在相同的父
菜单下重复菜单项。
Is there any specific reason to have same name of menus ? Coded UI Test handles duplicate controls at most of the time e.g., buttons, text boxes etc. Not doing the same for menu items was intentional as we dont expect dupliate menu items under the same parent menu.
如果是这样,你可以使用"实例"。重复菜单的属性,以便在播放期间获得正确的菜单项。假设menuItem是具有重复名称的UI控件。
If this is intended, you can use "Instance" property for the duplicate menu to get the right menu item during playback. Say menuItem is the UI Control that has duplicate name.
menuItem.SearchProperties [" Instance"] =" 2";
menuItem.SearchProperties["Instance"] = "2";
你应该在UIMap.cs文件中进行此自定义。
You should do this customization in UIMap.cs file.
谢谢。
这篇关于菜单控件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!