UI控件映射:如何在不创建冗余父对象的情况下向UI控件映射添加新控件? [英] UI Control Map: How do we add new controls to the UI Control Map, without creating redundant parent objects?

查看:106
本文介绍了UI控件映射:如何在不创建冗余父对象的情况下向UI控件映射添加新控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说明:
我想再来一次,并将其他控件添加到我的UI控件映射中,而无需编辑器创建多余的父控件.如果我不关闭Web浏览器就一次添加所有控件,就不会出现这种情况.然而, 如果我关闭网络浏览器,然后稍后返回以添加另一个控件,则编辑器将创建一个冗余的父控件.如何避免这种情况?

Description:
I would like to come back at another time and add addition controls to my UI Control Map, without the editor creating redundant parent controls. This does not appear to happen if I add all the controls in one sitting without close the web browser. However, if I close the web browser and then return later to add another control, the editor creates a redundant parent control. How do I avoid this?

详细信息:
1.我创建了一个VS 2012"编码UI测试项目",并在其中添加了一个名为" MSDN_Home_Page.uitest "的"编码UI测试图".项目,然后使用"使用编码的UI测试生成器进行编辑",我在 " http://msdn.microsoft.com/zh-cn/ "页面添加到我的UI控件映射文件中,并将其重命名并其父级控件的可读性.

Details:
1. I created a VS 2012 "Coded UI Test Project", added a "Coded UI Test Map" named "MSDN_Home_Page.uitest" to the project, and then, using the "Edit With Coded UI Test Builder", I added the "Home" link control on the "http://msdn.microsoft.com/en-us/" page to my UI Control Map file, and renamed it and its parent controls for readability.

2.接下来,我重新启动了"使用编码的UI测试生成器进行编辑"并重新打开浏览器,然后导航回" http://msdn .microsoft.com/en-us/ ",这次我尝试添加"" 将控件链接到我的UI控件映射.但是,不是将" Library "链接控件放置在现有的" Header "控件中,而是将" Library "控件存储在新控件,我们将其命名为" Header2 ". (笔记: 我已重命名了控件及其父控件的可读性)

2. Next, I restarted the "Edit With Coded UI Test Builder" and re-opened the browser, and navigated back to "http://msdn.microsoft.com/en-us/", and this time I attempted to add the "Library" link control to my UI Control Map. However, instead of the "Library" link control being placed inside the existing "Header" control, the "Library" control is stored inside a new control, which we’ve named "Header2". (Note: I’ve renamed the control and its parent controls readability)

3.为什么"使用编码的UI测试生成器进行编辑"没有将" Library_link "对象放在" Header "下?两个标题控件的搜索"属性似乎都相同.

3. Why didn’t "Edit With Coded UI Test Builder" put the "Library_link" object under "Header"? The Search properties of both header controls appear to be identical.

标题"属性:

"Header" properties:

"Header2"属性:

"Header2" properties:

推荐答案

JETFIRE,

Hello JETFIRE,

谢谢您的发帖.

根据您的详细描述,我创建了一个编码的UI测试项目,通过在目标控件上拖动十字准线,然后单击复制"以将其添加到UIMap,以在VS2012中复制您的方案.

Based on your detailed description, I have created a coded UI test project to repro your scenario in VS2012 through dragging the crosshair on the target control and then clicking Copy to add it to UIMap.

对于经过编码的UItestproject1,我得到以下预期结果:

For coded UItestproject1, I get the following result which is expected:

此外,我创建另一个codedUItestproject3,以通过单击目标控件将控件添加到UIMap.我得到了预期的以下结果:

In addition, I create another codedUItestproject3 to add controls to UIMap through clicking on the target control. I get the following result which is also expected:

我无法复制您的问题.我进行了研究并找到了一个博客( CodedUITestBuilder.exe.config以查看MaxLevelsForItemContainer密钥是否存在.如果键不存在,则默认值仍仅为2.我建议您尝试添加密钥并设置另一个值,例如3,4等,以检查是否有一些 差异.

I can’t repro your issue. I did a research and find a blog (How to test deep hierarchy controls using Coded UI Test in WPF?). Even though that blog is especially applied for WPF app, you still can try to check the CodedUITestBuilder.exe.config to see if MaxLevelsForItemContainer key exists. If the key does not exist the default value still is 2 only. I suggest that you try to add the key and set another value such as 3,4 etc to check if there are some differences.

此外,由于我可以得到期望的结果,因此建议您可以在另一台计算机上尝试相同的方案来检查结果.

我怀疑该问题可能与您的VS有关.

您可以找到IDE文件夹,然后运行以下命令来检查它是否有帮助:

C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE

Devenv.exe/SafeMode:以最小加载窗口的安全模式启动IDE.

Devenv.exe/ResetSettings:恢复IDE的默认设置,还可以选择重置为指定的VSSettings文件.

Devenv.exe/ResetAddin:删除与指定加载项关联的命令和命令UI.

Devenv.exe/ResetSkipPkgs:清除添加到VSPackages的所有SkipLoading标签.

最好的问候


这篇关于UI控件映射:如何在不创建冗余父对象的情况下向UI控件映射添加新控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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