The UIAElement
class is the superclass for all user interface elements.
parent
elements
ancestry
activityIndicators
buttons
images
links
pageIndicators
pickers
progressIndicators
scrollViews
segmentedControls
sliders
staticTexts
switches
tableViews
textFields
secureTextFields
searchBars
textViews
webViews
These methods allow you to effect the common gestures and actions a user can perform through the user interface. Options are available for use with some of these methods to give you flexibility in defining and varying the attributes of the gesture or action to be performed.
tap
tapAndHold
doubleTap
twoFingerTap
touchWithOptions
dragInsideWithOptions
flickInsideWithOptions
scrollToVisible
Use these methods to determine whether an element is still valid.
Returns a UIAElementArray
of UIAActivityIndicator
objects contained by the specified object.
(UIAElementArray) activityIndicators()
Returns a UIAElementArray
of objects that are parent to the specified object.
(UIAElementArray) ancestry()
Returns a UIAElementArray
of UIAButton
objects contained by the specified object.
(UIAElementArray) buttons()
Returns the specified elements’ current validity status.
(Boolean) checkIsValid()
Use this method to determine whether the user interface element represented by the specified UIAElement currently exists. This requires a call to the underlying Accessibility framework to ensure the validity of the result.
isValid
Drags within the bounds of an element.
(undefined) dragInsideWithOptions(Object options)
A dictionary that specifies characteristics of the gesture. Valid keys are as follows:
| The number of touches to use in the specified gesture. (Effectively, the number of fingers a user would use to make the specified gesture.) The default touch count value is 1. |
| The length of hold time for the specified gesture. The default duration value for a tap is 0. The default value for touch-and-hold gestures (such as drag, pinch open, and pinch close) is 1. |
| The first offset to use for a multiple-point gesture. The default value is {x:0.0, y:0.0}. See the discussion for details. |
| The last offset to use for a multiple-point gesture. The default value is {x:0.0, y:0.0}. See the discussion for details. |
You can use offsets to achieve finer precision in specifying the hitpoint within the rect
for the specified element. The offset comprises a pair of x and y values, each ranging from 0.0 to 1.0. These values represent, respectively, relative horizontal and vertical positions within the rect
, with {x:0.0, y:0.0} as the top left and {x:1.0, y:1.0} as the bottom right. Thus, {x:0.3, y:0.6} specifies a position just below and to the left of center, and {x:1.0, y:0.5} specifies a position centered vertically at the far right.
This example performs a slow drag within the target element from left edge to right edge, just below the top:
target.dragInsideWithOptions({startOffset:{x:0.0, y:0.1}, endOffset:{x:1.0, y:0.1}, duration:1.5});
Returns a UIAElementArray
of objects contained by the specified object.
(UIAElementArray) elements()
Flicks within the bounds of an element.
(undefined) flickInsideWithOptions(Object options)
A dictionary that specifies characteristics of the gesture. Valid keys are as follows:
| The number of touches to use in the specified gesture. (Effectively, the number of fingers a user would use to make the specified gesture.) The default touch count value is 1. |
| The first offset to use for a multiple-point gesture. The default value is {x:0.0, y:0.0}. See the discussion for details. |
| The last offset to use for a multiple-point gesture. The default value is {x:0.0, y:0.0}. See the discussion for details. |
You can use offsets to achieve finer precision in specifying the hitpoint within the rect
for the specified element. The offset comprises a pair of x and y values, each ranging from 0.0 to 1.0. These values represent, respectively, relative horizontal and vertical positions within the rect
, with {x:0.0, y:0.0} as the top left and {x:1.0, y:1.0} as the bottom right. Thus, {x:0.3, y:0.6} specifies a position just below and to the left of center, and {x:1.0, y:0.5} specifies a position centered vertically at the far right.
This example performs a flick just above the bottom edge of the target element, from center to right edge:
target.flickInsideWithOptions({startOffset:{x:0.5, y:0.9}, endOffset:{x:1.0, y:0.9}});
Returns true if the specified element is the receiver of keyboard input.
(Boolean) hasKeyboardFocus()
Returns a UIAElementArray
of UIAImage
objects contained by the specified object.
(UIAElementArray) images()
Returns the specified element’s validity status as of the most recent access.
(Boolean) isValid()
Use this method to determine whether the user interface element represented by the specified UIAElement existed as of the last attempt to access it. To be certain that the element exists, use checkIsValid
instead.
checkIsValid
Returns true if the user interface element represented by the specified element is visible on screen.
(Boolean) isVisible()
Returns a UIAElementArray
of UIALink
objects contained by the specified object.
(UIAElementArray) links()
Logs information about this element and all of its sub-elements.
(undefined) logElementTree()
Returns a UIAElementArray
of UIAPageIndicator
objects contained by the specified object.
(UIAElementArray) pageIndicators()
Returns a UIAElementArray
of UIAPicker
objects contained by the specified object.
(UIAElementArray) pickers()
Returns a UIAElementArray
of UIAProgressIndicator
objects contained by the specified object.
(UIAElementArray) progressIndicators()
Scrolls until the specified element is visible in a container view.
(undefined) scrollToVisible()
Use this method with tables and web views.
Returns a UIAElementArray
of UIAScrollView
objects contained by the specified object.
(UIAElementArray) scrollViews()
Returns a UIAElementArray
of UIASearchBar
objects contained by the specified object.
(UIAElementArray) searchBars()
Returns a UIAElementArray
of UIASecureTextField
objects contained by the specified object.
(UIAElementArray) secureTextFields()
Returns a UIAElementArray
of UIASegmentedControl
objects contained by the specified object.
(UIAElementArray) segmentedControls()
Returns a UIAElementArray
of UIASlider
objects contained by the specified object.
(UIAElementArray) sliders()
Returns a UIAElementArray
of UIAStaticText
objects contained by the specified object.
(UIAElementArray) staticTexts()
Returns a UIAElementArray
of UIASwitch
objects contained by the specified object.
(UIAElementArray) switches()
Returns a UIAElementArray
of UIATableView
objects contained by the specified object.
(UIAElementArray) tableViews()
Touches the specified element and holds for the specified duration.
(undefined) tapAndHold(Number duration)
The length of time to hold the touch on the element, in seconds.The default duration value for a tap is 0. The default value for touch-and-hold gestures (such as drag, pinch open, and pinch close) is 1.
Returns a UIAElementArray
of UIATextField
objects contained by the specified object.
(UIAElementArray) textFields()
Returns a UIAElementArray
of UIATextView
objects contained by the specified object.
(UIAElementArray) textViews()
Performs the specified gesture on the specified element using a dictionary to specify gesture attributes.
(undefined) touchWithOptions(Object options)
A dictionary that specifies characteristics of the gesture. Valid keys are as follows:
| The number of taps that compose the specified gesture. The default value is 1 (single tap). |
| The number of touches to use in the specified gesture. (Effectively, the number of fingers a user would use to make the specified gesture.) The default touch count value is 1. |
| The length of hold time for the specified gesture. The default duration value for a tap is 0. The default value for touch-and-hold gestures (such as drag, pinch open, and pinch close) is 1. |
| The offset to use for the specified tap gesture. The default offset value is {x:0.0, y:0.0}. See the discussion for details. |
For example, you could specify a triple tap with two fingers at the center of the screen (on an iPhone in portrait orientation), as follows:
target.tapWithOptions({x:160, y:240}, {touchCount:2, tapCount:3});
You can use offsets to achieve finer precision in specifying the hitpoint within the rect
for the specified element. The offset comprises a pair of x and y values, each ranging from 0.0 to 1.0. These values represent, respectively, relative horizontal and vertical positions within the rect
, with {x:0.0, y:0.0} as the top left and {x:1.0, y:1.0} as the bottom right. Thus, {x:0.3, y:0.6} specifies a position just below and to the left of center, and {x:1.0, y:0.5} specifies a position centered vertically at the far right.
Returns a string containing a value attribute specific to the type of element.
(String) value()
For example, a switch has a value of 1
for ON an 0
for OFF.
Waits for the specified element to become invalid.
(Boolean) waitForInvalid()
Waits for the user interface element represented by the specified UIAElement to become invalid. Uses the current timeout
value for the wait time interval.
Returns a UIAElementArray
of UIAWebView
objects contained by the specified object.
(UIAElementArray) webViews()
Returns a UIAElement if its name attribute matches a specified string.
(UIAElement) withName(String name)
A string containing the name to test for.
Tests if the name attribute of the element has the given string value. If the match fails, the test is retried until the current timeout
expires.
Returns a UIAElement if it matches specified criteria.
(UIAElement) withPredicate(PredicateString predicateString)
A string specifying the match criteria.
Uses the specified predicate string to test for a match. If the match fails, the test is retried until the current timeout
expires. See Predicate Programming Guide for information about using predicates.
Returns a UIAElement if it has the specified property with the specified value.
(UIAElement) withValueForKey(NotTyped value, String key)
A string specifying the value that the specified property, if it exists, should match.
A string specifying the property to test for.
Tests if the element has a specified property with the specified value. If the match fails, the test is retried until the current timeout
expires.
Last updated: 2010-05-27