【问题标题】:Xcode Instruments - UIAButton Class - Method .isEnabled() not workXcode Instruments - UIAButton 类 - 方法 .isEnabled() 不起作用
【发布时间】:2013-10-31 00:33:26
【问题描述】:

我正在编写一些代码来使用 X 代码和仪器测试 IOS 应用程序。我想在打开/关闭按钮时检查按钮的状态。我尝试使用方法 .isEnabled() 检查它是否打开/关闭,但无法确定状态。换句话说,无论是否点击按钮,仪器总是通过“if (mainWindow.popover().buttons()[17].isEnabled())”这一行。

这是我的部分代码:

//Button is OFF as default
//Tap to turn it ON
mainWindow.popover().buttons()[17].tap();
//Have a short delay to ensure it changes state
target.deday(1);
//Check to see if it's ON
if (mainWindow.popover().buttons()[17].isEnabled()) {
   UIALogger.logMessage("button ON");
}
...

【问题讨论】:

    标签: javascript xcode ipad instruments ios-ui-automation


    【解决方案1】:

    此问题的根本原因是按钮在切换开/关时没有返回任何值。如果它关闭,它应该返回值 0,如果它打开,它应该返回 1。我正在与开发团队一起解决这个问题。

    顺便说一句,我也误解了函数 .IsEnabled() 因为它只检查按钮是否能够点击。如果按钮显示为灰色(无法点击),该函数将返回 false。否则,它应该返回 true :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多