I use UIAutomation to automate the iPad application. I tried using (object) executeTaskWithPathArgumentsTimeout (path, arguments, timeout) to run Safari.app from my script:
var target = UIATarget.localTarget(); var host = target.host(); var result = host.performTaskWithPathArgumentsTimeout("/Applications/Safari.app", ["http://www.google.com"], 30); UIALogger.logDebug("exitCode: " + result.exitCode); UIALogger.logDebug("stdout: " + result.stdout); UIALogger.logDebug("stderr: " + result.stderr);
I got the following results: exitCode: 5 standard output: STDERR:
Ive also tried to run an echo:
var target = UIATarget.localTarget(); var host = target.host(); var result = host.performTaskWithPathArgumentsTimeout("/bin/echo", ["Hello World"], 5); UIALogger.logDebug("exitCode: " + result.exitCode); UIALogger.logDebug("stdout: " + result.stdout); UIALogger.logDebug("stderr: " + result.stderr);
Results: exitCode: 0 stdout: Hello world STDERR:
So, it seems that performTaskWithPathArgumentsTimeout only works for specific applications.
Could you help me answer the following questions: 1. What does exitCode = 5 mean? 2. What processes can be started using the executeTaskWithPathArgumentsTimeout function?
source share