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 seemsUIMap.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),
Try the below solution once as the bounding rectangle is correct or not:-
- Do a ButtonControl.DrawHighlight(). Check if the entire correct button boundary is getting highlighted.
- ButtonControl.BoundingRectangle. Does this return non-zero values ?
- If [2] is true, Rectangle r = ButtonControl.BoundingRectangle.
ButtonControl.SetFocus()
Mouse.Click(new Point(r.X + r.Width/2, r.Y + r.Height/2));
精彩评论