【问题标题】:COM Exception HRESULT : 0XF004F003 while performing Mouse.Click(button) operation on a WinButton in Coded UICOM 异常 HRESULT : 0XF004F003 在编码 UI 中对 WinButton 执行 Mouse.Click(button) 操作时
【发布时间】:2015-01-11 15:00:37
【问题描述】:

当我试图自动关闭 IDE 时,该按钮出现在 Eclipse IDE 的 ConfirmExit 窗口中。有问题的窗口有 2 个按钮“确定”和“取消”。DrawHighlight() 已成功识别按钮,因此问题似乎不在搜索属性中。例外是 '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 方法能够正确识别并执行单击此按钮。我使用了 Designer 类中使用的相同层次结构。虽然没有'没有。这是操作系统问题吗?我使用的是 Win 8.1 和 Visual Studio 2012 Premium。 有人对此有解决方案吗?

【问题讨论】:

  • 给微软买一支雪茄是为了好的命名,当然“隐藏控制”是这次事故的重要组成部分。不要试图点击不可见的按钮。谷歌异常名称,你会发现 KB2870699 很可能是相关的。

标签: c# coded-ui-tests


【解决方案1】:

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

button.FindMatchingControls();

【讨论】:

  • button.Find() 或者上面提到的可以用。谢谢!
猜你喜欢
  • 1970-01-01
  • 2011-08-13
  • 2020-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多