Ios UIImagePickerController编辑时:无法点击按钮()[2]
在UIImagePickerController的裁剪屏幕中,我试图使用UIAutomation点击“选择”按钮,但出现以下错误: 无法点击target.frontMostApp().mainWindow().buttons()[2] 我正在使用以下代码:Ios UIImagePickerController编辑时:无法点击按钮()[2],ios,objective-c,uiimagepickercontroller,ui-automation,ios-ui-automation,Ios,Objective C,Uiimagepickercontroller,Ui Automation,Ios Ui Automation,在UIImagePickerController的裁剪屏幕中,我试图使用UIAutomation点击“选择”按钮,但出现以下错误: 无法点击target.frontMostApp().mainWindow().buttons()[2] 我正在使用以下代码: var b = target.frontMostApp().mainWindow().buttons()[2]; if (b.checkIsValid()) { UIALogger.logPass("b, " +
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:name:Choose rect:{{287604},{74,40}
target.frontMostApp().mainWindow().buttons()[2]。点击()
无法点击target.frontMostApp().mainWindow().buttons()[2]
脚本引发未捕获的JavaScript错误:无法在新%20Script的第13行上点击target.frontMostApp().mainWindow().buttons()[2]
有人知道如何测试这个?。感谢您的帮助。我也遇到了同样的问题,我找到了以下解决方案:
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});
这不是很好,但它很有效