OGeek|极客世界-中国程序员成长平台

标题: ios - 使用命令行的 UIAutomation 不起作用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 13:18
标题: ios - 使用命令行的 UIAutomation 不起作用

这是我在终端中执行的代码:

instruments -w 'afb79e6f07256ff94c8d5a11e4db6c26950e2b2d' \
    -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
    'TestAutomation.app' \
    -e UIASCRIPT '/Users/roykronenfeld/Desktop/Automation.js' \
    -e UIARESULTSPATH '/Users/roykronenfeld/Desktop/' 

我得到的错误:

Instruments Usage Error : Specified target process is invalid:
/var/mobile/Applications/51EA888D-9D16-4F7B-919F-68F9C56F0585/TestAutomation.app

这显然表明应用程序的路径不正确。但是,如果我使用以下代码从 Xcode 中提取该应用程序路径,我不确定它为什么不正确:

NSString *Directory = [[NSBundle mainBundle] resourcePath];

有什么想法吗?

p.s:该应用已安装在设备上。



Best Answer-推荐答案


这是它的工作方式:

instruments -w 'fa10dec83c62a571a9691b5d9ef24cc68de73bf0' \
    -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
     TestAutomation \
    -e UIASCRIPT '/Users/roykronenfeld/Desktop/Automation.js' \
    -e UIARESULTSPATH '/Users/roykronenfeld/Desktop‘ 

请注意应用名称末尾没有 '' 和 .app 的情况,因为通过命令行在设备上进行自动化操作时,您需要提供的只是应用名称。

关于ios - 使用命令行的 UIAutomation 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27544621/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4