UIATable 操作 GetCellValue 抛出错误 "Failed due to a lacking or broken API call inherited from UI Automation"

UIATable operation GetCellValue throws error "Failed due to a lacking or broken API call inherited from UI Automation"

我正在使用 UI 自动化加载项来自动化和测试在 Java window 中包含 HTML 个对象的应用程序。我已将 UIATable 识别并保存在我的对象存储库中,以下方法工作正常:

MsgBox UIAWindow("**").UIAObject("**").UIATable("**").RowCount     'Prints 3
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").ColumnCount  'Prints 5

但是,当我尝试使用以下任一方法获取单元格值时:

MsgBox UIAWindow("**").UIAObject("**").UIATable("**").GetCellValue(1,1) 'Error
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").GetCellData(1,1)  'Error
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").GetCellName(1,1)  'Error

我收到一条错误消息:

The test run cannot continue due to an unrecoverable error. <0x80070057> Failed due to a lacking or broken API call inherited from UI Automation.

我正在使用 UFT 14.02。此错误的可能原因是什么?我可以做些什么来解决这个问题?

看看UFT 14 Product Availability Matrix。您需要“UFT GUI 测试 UI 自动化插件”部分。

JavaFX 受支持,但 HTML 不受 UFT 中的 UI 自动化框架支持。 这可能就是为什么有些方法有效而另一些方法无效的原因。即您可以阅读 java table,但无法验证 html 内容。

(我假设您正在针对 javaFX 应用程序进行测试?-您只是说 java)

值得一提的是,“不支持”并不意味着它不会工作,只是它没有经过 Microfocus 的全面测试和认证。

另外,如果你检查 the support pages 它有一个很大的注释:

Note: The test objects and methods available are completely dependent on the properties and patterns implemented in your application. We recommend that you familiarize yourself with the properties of your application's objects - specifically the Control Type IDs and supported patterns to understand what test objects and methods you can use.

所以错误可能不是你,也可能不是 UFT。这可能是测试中应用程序交付的结果。

您可以尝试的事情...

  • 尝试实际的 java 加载项 - 可以同时使用多个加载项 - 即使它只是一个对象的变通方法。
  • 尝试标准 windows 对象标识符。
  • 确认应用程序构建为支持 Microsoft 的 UI 自动化
  • 更新到最新的 UFT(撰写本文时为 UFT 15.01,现在也称为 UFT One)以确保您的库尽可能最新

如果一切都失败了,请告诉我。 UFT 在 GUI 方面非常灵活,根据您需要与 table 交互的方式,我们可以尝试一些其他解决方案。