我写了下面的代码,
WinWindow w = new WinWindow();
w.SearchProperties[WinWindow.PropertyNames.Name] = "Card Action";
w.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
w.SearchProperties[WinButton.PropertyNames.ControlType] = "Window";
WinWindow w2 = new WinWindow(w);
w2.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
w2.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
w2.SearchProperties[WinWindow.PropertyNames.ControlType]="Window";
w2.SearchProperties[WinWindow.PropertyNames.Name] = "Insert Card";
w2.SearchProperties[WinWindow.PropertyNames.ControlId] = "2032";
WinButton b1 = new WinButton(w2);
b1.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
b1.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
b1.SearchProperties[WinButton.PropertyNames.ControlType] = "Button";
b1.SearchProperties[WinButton.PropertyNames.ClassName] = "Button";
b1.SearchProperties[WinButton.PropertyNames.Name] = "Insert Card";
b1.DrawHighlight();
Mouse.Click(b1);
它已识别控件,但无法执行点击操作。
错误: 测试方法CodedUITestMethod1抛出异常: 另一个控件正在阻止该控件。请使被阻止的控件可见,然后重试该操作。其他详细信息:TechnologyName:'MSAA'名称:'Insert Card'类名:'Button'控件类型:'Window'
输出截图 https://i.stack.imgur.com/mhbgj.png
请帮助我解决此问题。 预先感谢!