编码的UI测试创建-无法在隐藏的控件上执行“单击". [英] Coded UI Test creation - Cannot perform 'Click' on the hidden control.

查看:109
本文介绍了编码的UI测试创建-无法在隐藏的控件上执行“单击".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用VS2013创建自动测试(记录codedUI测试).在我们的一个应用程序上,我遇到了一个非常令人沮丧的问题-我在论坛上进行了搜索,尽管我可以找到其他类似的问题,但它们无法解决我所遇到的问题 有.帮助!! :)

I've started using VS2013 to create Automated tests (recording codedUI tests). On one of our apps I'm getting a really frustrating problem - I've searched through the forum, and although I can find other similar questions they don't address the issue I'm having. Help!! :)

基本上,我正在一个应用程序上进行测试,其中两个屏幕的布局/控件非常相似,可以逐行访问这些屏幕(即,第一个页面->单击下一步->第2页).两者都具有服务器".下拉式菜单.  从记录编码的UI 我有以下

代码:

Basically, I'm testing on an app where two of the screens have very similar layout/controls, the screens are accessed lineraly (ie page one -> Click Next -> Page 2). Both having a "Server" dropdown menu.  From recording the coded UI testI have the following

code:

//单击打开" DropDownButton
Mouse.Click(uIOpenDropDownButton,new Point(10,9));

//单击(本地)"列表框中编号为3的列表项
Mouse.Click(uIItemListItem,new Point(159,7));

 //单击下一步>"按钮
Mouse.Click(uINextButton,new Point(31,9));

//单击打开" DropDownButton
Mouse.Click(uIOpenDropDownButton2,new Point(13,8));

//单击(本地)"列表框中编号为3的列表项
Mouse.Click(uIItemListItem,new Point(230,1));

// Click 'Open' DropDownButton
Mouse.Click(uIOpenDropDownButton, new Point(10, 9));

// Click list item numbered 3 in '(local)' list box
Mouse.Click(uIItemListItem, new Point(159, 7));

 // Click 'Next >' button
Mouse.Click(uINextButton, new Point(31, 9));

// Click 'Open' DropDownButton
Mouse.Click(uIOpenDropDownButton2, new Point(13, 8));

// Click list item numbered 3 in '(local)' list box
Mouse.Click(uIItemListItem, new Point(230, 1));

声明:
WinListItem uIItemListItem = this.UIItemWindow.UILocalList.UIItemListItem;

Declaration:
WinListItem uIItemListItem = this.UIItemWindow.UILocalList.UIItemListItem;

此代码抛出以下错误:

结果消息:
测试方法CodedUITestProject1.CodedUITest1.CodedUITestMethod1引发异常:
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException:无法对隐藏的控件执行单击".其他详细信息:
技术名称: 'MSAA'
ControlType: 'ListItem'
  --- System.Runtime.InteropServices.COMException:HRESULT的异常:0xF004F002

Result Message:
Test method CodedUITestProject1.CodedUITest1.CodedUITestMethod1 threw exception: 
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control. Additional Details: 
TechnologyName:  'MSAA'
ControlType:  'ListItem'
 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F002

自动运行良好,直到单击第二个下拉菜单.点击似乎发生了,但是下拉列表没有展开,并且测试失败.

如果我从应用程序的第二个屏幕开始测试(即,直到我手动设置了第一页之后才开始记录,则该页面的自动化效果很好.仅当我尝试从应用程序打开/第1页的记录中进行记录时)应用有问题.

The automation works fine until the click on the second drop down menu. The click seems to happen, but the dropdown doesn't expand and the test fails.

If I start the test from the second screen in the app (ie I don't start recording until I've set out the first page manually the automation of that page is fine. Only when I try recording from app opening/page 1 of app is there a problem.

使用" uIItemListItem.SelectedItemAsString "建议其他线程之一(为了清楚起见,我在这里替换了自己的下拉名称),但这给了我

构建错误:
''Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinListItem'不包含'SelectedItemAsString'的定义,也没有扩展方法'SelectedItemAsString'接受类型为'Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinListItem'的第一个参数 可以找到(您是否缺少using指令或程序集引用?)".

One of the other threads suggested using "uIItemListItem.SelectedItemAsString" (I've substituted my own dropdown name there for clarities sake) but that gives me

Build error:
"'Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinListItem' does not contain a definition for 'SelectedItemAsString' and no extension method 'SelectedItemAsString' accepting a first argument of type 'Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinListItem' could be found (are you missing a using directive or an assembly reference?)".

任何帮助将不胜感激!

推荐答案

p8ddy,

Hi p8ddy,

感谢您的发帖!

根据您的代码,建议您尝试修改代码.请尝试先添加这些代码 Mouse.Click(uIOpenDropDownButton2,新Point(13,8));

Based on your code, I suggest that you could try to modify the code. Please try to add these code before Mouse.Click(uIOpenDropDownButton2, new Point(13, 8));

uIOpenDropDownButton2. WaitForControlEnabled();

uIOpenDropDownButton2.SetFocus()

有一个链接可能会对您有所帮助:

There is a link that may help you:

#使用编码的UI测试编辑器将方法移至UIMap以启用完全自定义

http://msdn.microsoft.com/en-us/library /gg269473(v=vs.100).aspx

http://windows.microsoft.com/zh-CN/skydrive/change-access-permissions-faq )

If you still have the issue, please provide the details of your app that you test. (Share app to me will be better for me to find the issue quickly, about share files in the SkyDrive, please refer to: http://windows.microsoft.com/en-us/skydrive/change-access-permissions-faq)

Best Regards


这篇关于编码的UI测试创建-无法在隐藏的控件上执行“单击".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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