无法重播作为自定义控件一部分的按钮的记录的编码 UI 测试操作
我使用VS 2010编码的UI测试将Click
操作记录到由combobox
和按钮组成的自定义控件的combobox
并生成代码。
然后我使用 VS 2010 编码 UI 测试将 Click
操作记录到由 combobox
和按钮以及生成的代码组成的自定义控件的按钮。
当我在组合框上单击重放时,它工作正常。
当我重播按钮上的单击时,我遇到了异常:
Cannot perform 'Click' on the hidden control
刷新后的编码 UI 测试可以找到并突出显示该按钮。
看来 UIMap.Designer
生成了正确的控件声明。
在对按钮执行“单击”之前,我尝试了 SetFocus
。
如果我获取 ControlCollection
并显示带有集合中每个控件的 BoundingRectangle
属性的消息,则 BoundingRectangle
指向不同的 Control。
如何使录制的自定义控件按钮上的“单击”可重新播放。
I used VS 2010 Coded UI Test to record Click
action to the combobox
of Custom Control that consists of combobox
and button and generated a code.
Then I used VS 2010 Coded UI Test to record Click
action to the button of Custom Control that consists of combobox
and button and generated code.
When I did Replay of the Click on the combobox it is working fine.
When I did Replay of the Click on the button I got an exception:
Cannot perform 'Click' on the hidden control
Coded UI Test after refresh can find and highlight the button.
It seems UIMap.Designer
generates proper declaration of the Control.
Before performing "Click" on the Button I tried SetFocus
.
If I get ControlCollection
and show message with BoundingRectangle
properties of every control in the collection then BoundingRectangle
point to the different Control.
How to make recorded "Click" on the Button of the custom control to be re-playable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有时控件会呈现为其他控件的组合。
记录器找到您的按钮后,查看它是否有子控件(单击向下箭头,或 Alt + 向下),
Sometimes controls are rendered as composites of other controls.
After the recorder finds your button, see if it has child controls (click on the Down arrow, or Alt + Down), . This happened to me several times while testing a Silverlight application, an image or text blocks the actual button.
Hope this helps.
尝试以下解决方案一次,确定边界矩形是否正确:-
矩形 r = ButtonControl.BoundingRectangle。
ButtonControl.SetFocus()
Mouse.Click(new Point(rX + r.Width/2, rY + r.Height/2));
Try the below solution once as the bounding rectangle is correct or not:-
Rectangle r = ButtonControl.BoundingRectangle.
ButtonControl.SetFocus()
Mouse.Click(new Point(r.X + r.Width/2, r.Y + r.Height/2));