开发者

Cannot Replay recorded Coded UI Test action for the button that is the part of the custom control

I used VS 2010 Coded UI Test to record Clic开发者_JAVA百科k 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.


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),

Cannot Replay recorded Coded UI Test action for the button that is the part of the custom control

. This happened to me several times while testing a Silverlight application, an image or text blocks the actual button. Hope this helps.


Try the below solution once as the bounding rectangle is correct or not:-

  1. Do a ButtonControl.DrawHighlight(). Check if the entire correct button boundary is getting highlighted.
  2. ButtonControl.BoundingRectangle. Does this return non-zero values ?
  3. If [2] is true, Rectangle r = ButtonControl.BoundingRectangle.

ButtonControl.SetFocus()

Mouse.Click(new Point(r.X + r.Width/2, r.Y + r.Height/2));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜