在 UIImagePickerController 的裁剪屏幕中,我尝试使用 UIAutomation 点击“选择”按钮,但出现此错误:
target.frontMostApp().mainWindow().buttons()[2] could not be tapped
我正在使用此代码:
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, true, 1
UIAButton: name:Choose rect:{{287, 604}, {74, 40}}
target.frontMostApp().mainWindow().buttons()[2].tap()
target.frontMostApp().mainWindow().buttons()[2] could not be tapped
Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().buttons()[2] could not be tapped on line 13 of New%20Script
有人知道如何测试吗?感谢您的帮助。
Best Answer-推荐答案 strong>
我也遇到了同样的问题,我找到了这个解决方案:
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});
这不是很好,但它工作......
关于ios - UIImagePickerController 编辑时 : buttons()[2] could not be tapped,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/27495649/
|