【问题标题】:UIAutomation using command line doesn't work使用命令行的 UIAutomation 不起作用
【发布时间】:2014-12-18 10:41:22
【问题描述】:

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

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:该应用已安装在设备上。

【问题讨论】:

  • 您是否在设备开发者设置中检查了自动化已启用?
  • @Crazyrems 是的,我的设备自动化模式已启用。

标签: ios ui-automation xcode-instruments


【解决方案1】:

它的工作方式如下:

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 的情况,因为通过命令行在设备上进行自动化操作时,您需要提供的只是应用名称。

【讨论】:

    【解决方案2】:

    你也可以使用“Bundle Identifier”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-11
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多