【问题标题】:UIImagePickerController when editing: buttons()[2] could not be tappedUIImagePickerController 编辑时:无法点击按钮()[2]
【发布时间】:2015-02-14 05:36:58
【问题描述】:

在 UIImagePickerController 的裁剪屏幕中,我尝试使用 UIAutomation 点击​​“选择”按钮,但出现此错误:

target.frontMostApp().mainWindow().buttons()[2] 无法点击

我正在使用此代码:

var b = target.frontMostApp().mainWindow().buttons()[2];

if (b.checkIsValid()) {
    UIALogger.logPass("b, " + b.isValid() + ", " + b.isEnabled());
    b.logElement();
    b.tap();
} else {
    UIALogger.logFail("!b");
}

这是输出:

b,真实,1

UIAButton:名称:选择矩形:{{287, 604}, {74, 40}}

target.frontMostApp().mainWindow().buttons()[2].tap()

target.frontMostApp().mainWindow().buttons()[2] 无法点击

脚本抛出未捕获的 JavaScript 错误:target.frontMostApp().mainWindow().buttons()[2] 无法在 New%20Script 的第 13 行点击

有人知道如何测试吗?感谢您的帮助。

【问题讨论】:

    标签: ios objective-c uiimagepickercontroller ui-automation ios-ui-automation


    【解决方案1】:

    我也遇到了同样的问题,我找到了这个解决方案:

    var b = target.frontMostApp().mainWindow().buttons()[2];
    var x = b.rect().origin.x + 1;
    var y = b.rect().origin.y + 1;
    target.tap({x:x, y:y});
    

    这不是很好,但它工作......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-27
      • 2018-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-27
      • 1970-01-01
      相关资源
      最近更新 更多