iOS Developer Library

Developer

UIAElementArray Class Reference

Options
Deployment Target:

On This Page

UIAElementArray

The UIAElementArray class supports operations with arrays containing multiple UIAElement objects. You can search the array by name or key/value pairs, or by custom criteria that you specify using a predicate. For detailed information about using predicates, see Predicates Programming Guide. More...

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Not Applicable Not Applicable
  • length Property

    Returns the number of user interface elements in the array.

    Declaration

    JavaScript

    (Number) length

  • Returns the first element in the array with this name.

    Declaration

    JavaScript

    (UIAElement) firstWithName(String name)

    Parameters

    name

    A string whose value is the name of the element match on.

  • Returns the first element in the array matching the given criteria.

    Declaration

    JavaScript

    (UIAElement) firstWithPredicate(PredicateString predicateString)

    Parameters

    predicateString

    A predicate specifying the criteria to match.

    Discussion

    For detailed information about predicate matching, see Predicate Programming Guide.

  • Returns the first element in the array with a value that matches the property key.

    Declaration

    JavaScript

    (UIAElement) firstWithValueForKey(NotTyped value, String key)

  • Converts the array into a standard JavaScript array.

    Declaration

    JavaScript

    (Array) toArray()

  • Returns all elements in the array with this name.

    Declaration

    JavaScript

    (UIAElementArray) withName(String name)

  • Returns all elements in the array matching the given.

    Declaration

    JavaScript

    (UIAElementArray) withPredicate(PredicateString predicateString)

    Discussion

    Predicate matching follows the same rules as NSPredicate.

  • Returns all elements in the array with a value that matches the property key.

    Declaration

    JavaScript

    (UIAElementArray) withValueForKey(NotTyped value, String key)

    Parameters

    value

    A string specifying the value that the specified property, if it exists, should match.

    key

    A string specifying the property to test for.

Constants

  • Declaration

    Constants

    • UIAElementNil

      UIAElementNil

      Returned by a function with return type UIAElement or UIAElementArray if the requested element is not available after the timeout grace period you specify. This mechanism allows your scripting expressions to complete even if an intermediate function in the expression fails temporarily during the grace period. For example, the following code does not raise an exception if the navigation bar does not exist; instead it returns UIAElementNil.

      • var backButton = UIATarget.localTarget().frontMostApp().navigationBar().buttons()["Back"];
      • if (backButton.isValid()) {
      • backButton.tap();
      • } else {
      • UIALogger.logError("Could not find 'Back' button!");
      • }

    Import Statement