可以从命令行运行 UI 自动化仪器吗? [英] Can the UI Automation instrument be run from the command line?

查看:38
本文介绍了可以从命令行运行 UI 自动化仪器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过终端打开UIAutomation工具?

Is there a way to open the UIAutomation instrument through the terminal?

是否可以编写一个 AppleScript 来打开 Apple 的 UIAutomation 工具并加载要测试的应用程序?

Will it be possible to write an AppleScript to open Apple's UIAutomation tool and load the application to be tested?

请问有什么办法可以通过脚本或者命令行打开UIAutomation,选择要测试的应用,以及选择测试脚本?

Can you please tell me is there any way through scripting or through the command line we can open UIAutomation and select the app to be tested, as well as select the test script?

推荐答案

instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/\
PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
<full_path_to_application> -e UIASCRIPT <path_to_script.js> \
-e UIARESULTSPATH <output_results_path>

对于 xcode >= 4.5

for xcode >= 4.5

instruments -t
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/\
AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
<full_path_to_application> -e UIASCRIPT <path_to_script.js> \
-e UIARESULTSPATH <output_results_path>

对于 xcode >= 6.1

for xcode >= 6.1

instruments -w <device ID> -t \
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/\
AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate \
<full_path_to_application> -e UIASCRIPT <path_to_script.js> \
-e UIARESULTSPATH <output_results_path>

不过有一些重要的事情需要注意:

There a few important things to note though:

  1. 除非您想在设备上运行脚本,否则不需要 -w 参数.如果您想在模拟器上运行您的脚本,只需在命令中省略此参数即可.
  2. full_path_to_application 是模拟器创建的 .app 文件的路径.对我来说,路径是

  1. the -w parameter is not required unless you want to run the scripts on your device. If you want to run your scripts on the simulator, simply omit this parameter from the command.
  2. full_path_to_application is the path to your .app file that is created by your simulator. For me, the path was

/Users/fwasim/Library/Application Support/iPhone Simulator/5.0/Applications/AA6BA2E1-D505-4864-BECC-29ADEE28194D/name_of_application.app

/Users/fwasim/Library/Application Support/iPhone Simulator/5.0/Applications/AA6BA2E1-D505-4864-BECC-29ADEE28194D/name_of_application.app

这条路径对于其他人来说可能会有所不同,具体取决于您在模拟器上运行的 iOS 版本.还要记住将此路径放在双引号中.

this path might be different for anyone else depending on what iOS version are you running on your simulator. Also remember to put this path in double quotation marks.

path_to_script.js 应该是保存用 javascript 编写的自动化脚本的完整路径.还要记住将此路径放在双引号中.

The path_to_script.js should be the FULL PATH to where your automation script written in javascript is saved. Also remember to put this path in double quotation marks.

最后输出结果路径是您要保存输出结果的路径.还要记住将此路径放在双引号中.

Lastly output results path is the path where you want to save the output results. Also remember to put this path in double quotation marks.

这些是我一直遗漏的要点,因此出现了上面提到的一些错误.

These were the points I had been missing on and thus was getting some of the errors mentioned above.

这篇关于可以从命令行运行 UI 自动化仪器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆