COM 异常 HRESULT:0XF004F003 在编码 UI 中对 WinButton 执行 Mouse.Click(按钮)操作时

COM Exception HRESULT : 0XF004F003 while performing Mouse.Click(button) operation on a WinButton in Coded UI

该按钮出现在 Eclipse IDE 的 ConfirmExit Window 中,因为我正在尝试自动关闭 IDE。有问题的 window 有 2 个按钮 "OK" 和 "Cancel".DrawHighlight() 已成功识别按钮,因此问题似乎不在搜索中 properties.The 异常是 'Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException' 使用的代码是

   Playback.PlaybackSettings.AlwaysSearchControls = true;
   exitWindow.getButton("OK").SetFocus();
   WinButton button = exitWindow.getButton("OK");

   exitWindow.getButton("OK").Find();
   exitWindow.getButton("OK").WaitForControlEnabled();
   Mouse.Click(button);//exception occurs here

令人惊讶的是,UIMap Designer 的 Recorded 方法能够正确识别并执行单击此 button.I 使用了与 Designer 中使用的相同层次结构 class.The exception 也谈到了一个被阻止的控件虽然不存在 any.Is 这是一个 OS 问题,但仍然存在?我使用的是 Win 8.1 和 Visual Studio 2012 Premium。 有人对此有解决方案吗?

这里的问题是一些其他控件阻止了您在执行操作之前尝试使用它执行 action.Try 的控件

button.FindMatchingControls();