我尝试使用Coded UI在Windows 10上点击Cortana搜索选项这段代码:
WinPane Desktop = new WinPane();
Desktop.TechnologyName = "MSAA";
Desktop.SearchProperties.Add(WinPane.PropertyNames.ClassName, "#32769");
Desktop.SearchProperties.Add(WinPane.PropertyNames.ClassName, "Shell_TrayWnd");
Desktop.SearchProperties.Add(WinPane.PropertyNames.ClassName, "TrayButton", WinButton.PropertyNames.ControlType, "Button");
Mouse.Click(Desktop);
有人可以建议我采用这种方法的正确方法吗?在运行此测试时,它显示"无法识别隐藏的控件"。
答案 0 :(得分:0)
尝试
Mouse.Click(Desktop.ToPoint())
其中ToPoint()是
public static Point ToPoint(this UITestControl control)
{
var point = new Point(control.BoundingRectangle.X + control.BoundingRectangle.Width / 2,
control.BoundingRectangle.Y + control.BoundingRectangle.Height / 2);
return point;
}