iOS Developer Library


UIAHost Class Reference

Deployment Target:

On This Page


The UIAHost class allows your script to exercise limited control over the Automation instrument process running on the host computer.

For an explanation of how to use this and related classes, see Automating UI Testing in Instruments User Guide.

  • Executes a task from the Automation instrument process running on the host.


    (object) performTaskWithPathArgumentsTimeout(path, args, timeout)



    The pathname of the code to run, relative to the root level of the host’s boot drive.


    An array that specifies the arguments for the code to be run.


    The length, in seconds, of the grace period in which the task is expected to execute, before script execution resumes.


    The process executes from within the context of the Instruments application parent process. The code below runs the echo command to display “Hello World” with a grace period of 5 seconds.

    The returned object contains the properties exitCode, stdout, and stderr. The example uses these properties to capture the exit code, standard output stream, and standard error stream, displaying each in a log message with a debug severity level.

    1. var target = UIATarget.localTarget();
    2. var host =;
    3. var result = host.performTaskWithPathArgumentsTimeout("/bin/echo", ["Hello World"], 5);
    4. UIALogger.logDebug("exitCode: " + result.exitCode);
    5. UIALogger.logDebug("stdout: " + result.stdout);
    6. UIALogger.logDebug("stderr: " + result.stderr);