我正在使用网络应用程序。当我回放我的测试时,点击超级链接失败了。我试过drawhighlight并找到匹配的控件,但没有运气。请查找错误详细信息:
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control. Additional Details:
TechnologyName: 'Web'
ControlType: 'Pane'
Id: 'ctl00_ctl00_ctl00_cntBody_cntBody_cntBody_listUsers_lblAdd'
Name: ''
TagName: 'SPAN'
---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F002
答案 0 :(得分:0)
我很难点击Pane并写了一个方法来获取Pane中心点的坐标。然后你可以点击那一点。
public Point getCenterPointOfUITestContol(UITestControl Object) {
Rectangle rectangle = Object.BoundingRectangle;
Point point = new Point(0, 0);
point.X = rectangle.X + (rectangle.Width / 2);
point.Y = rectangle.Y + (rectangle.Height / 2);
return point;
}
如果您的Pane以-1的坐标返回,那么它确实是隐藏的。