如何在终端中运行Apple UI Automation脚本?

时间:2015-01-23 10:51:29

标签: ios ios-ui-automation

instruments -w ‘AA6257B1-D3E0-49A6-85C2-F865B17ED6CD' \
-t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
'/Users/AZ-Admin/Downloads/test.app' \
-e UIASCRIPT '/Users/AZ-Admin/Desktop/UI\ Automation/ApTest.js' \
-e UIARESULTSPATH '/Users/AZ-Admin/Desktop/UI Automation'

以上是我给终端执行的指令。 我面临的问题是我的脚本没有执行只有我的模拟器弹出并显示应用程序

我也在给自己的自动化脚本存在的ApTest.js代码

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
var testName = "Create a New Appointment";
UIALogger.logStart(testName);
target.frontMostApp().mainWindow().elements()["Finder View"].buttons()["CRM"].tap();
target.frontMostApp().mainWindow().buttons()["New Appointment"].tap();
target.frontMostApp().mainWindow().tableViews()["Edit Table"].tapWithOptions({tapOffset:{x:0.56, y:0.21}});

谢谢

2 个答案:

答案 0 :(得分:0)

您是否尝试过使用Instruments GUI执行脚本?

此外,我尝试不使用UIARESULTSPATH,而是直接输出到控制台。

答案 1 :(得分:0)

您的-e UIASCRIPT '/Users/AZ-Admin/Desktop/UI\ Automation/ApTest.js' \行似乎有误。

请尝试使用-e UIASCRIPT "/Users/AZ-Admin/Desktop/UI/Automation/ApTest.js"

如果它在您指定的设备上启动您的应用,您就知道前两行是正确的。听起来,仪器一旦启动目标应用程序就不知道要运行什么测试代码。

相关问题