java.lang.Object | |
↳ | android.support.test.uiautomator.UiObject2 |
A UiObject2
represents a UI element. Unlike UiObject
, it is bound to a particular
view instance and can become stale if the underlying view object is destroyed. As a result, it
may be necessary to call findObject(BySelector)
to obtain a new
UiObject2
instance if the UI changes significantly.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clears the text content if this object is an editable field.
| |||||||||||
Clicks on this object.
| |||||||||||
Clicks on this object, and waits for the given condition to become true.
| |||||||||||
Drags this object to the specified location.
| |||||||||||
Drags this object to the specified location.
| |||||||||||
Searches all elements under this object and returns the first object to match the criteria.
| |||||||||||
Searches all elements under this object and returns all objects that match the criteria.
| |||||||||||
Performs a fling gesture on this object.
| |||||||||||
Performs a fling gesture on this object.
| |||||||||||
Returns the package name of the app that this object belongs to.
| |||||||||||
Returns the number of child elements directly under this object.
| |||||||||||
Returns a collection of the child elements directly under this object.
| |||||||||||
Returns the class name of the underlying
View represented by this
object.
| |||||||||||
Returns the content description for this object.
| |||||||||||
Returns this object's parent.
| |||||||||||
Returns the fully qualified resource name for this object's id.
| |||||||||||
Returns the text value for this object.
| |||||||||||
Returns the visible bounds of this object in screen coordinates.
| |||||||||||
Returns a point in the center of the visible bounds of this object.
| |||||||||||
Returns whether there is a match for the given criteria under this object.
| |||||||||||
Returns whether this object is checkable.
| |||||||||||
Returns whether this object is checked.
| |||||||||||
Returns whether this object is clickable.
| |||||||||||
Returns whether this object is enabled.
| |||||||||||
Returns whether this object is focusable.
| |||||||||||
Returns whether this object is focused.
| |||||||||||
Returns whether this object is long clickable.
| |||||||||||
Returns whether this object is scrollable.
| |||||||||||
Returns whether this object is selected.
| |||||||||||
Performs a long click on this object.
| |||||||||||
Performs a pinch close gesture on this object.
| |||||||||||
Performs a pinch close gesture on this object.
| |||||||||||
Performs a pinch open gesture on this object.
| |||||||||||
Performs a pinch open gesture on this object.
| |||||||||||
Recycle this object.
| |||||||||||
Performs a scroll gesture on this object.
| |||||||||||
Performs a scroll gesture on this object.
| |||||||||||
Sets the margins used for gestures in pixels.
| |||||||||||
Sets the margins used for gestures in pixels.
| |||||||||||
Sets the text content if this object is an editable field.
| |||||||||||
Performs a swipe gesture on this object.
| |||||||||||
Performs a swipe gesture on this object.
| |||||||||||
Waits for given the
condition to be met.
| |||||||||||
Waits for given the
condition to be met.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Clears the text content if this object is an editable field.
Clicks on this object.
Clicks on this object, and waits for the given condition to become true.
Drags this object to the specified location.
dest | The end point that this object should be dragged to. |
---|---|
speed | The speed at which to perform this gesture in pixels per second. |
Drags this object to the specified location.
dest | The end point that this object should be dragged to. |
---|
Searches all elements under this object and returns the first object to match the criteria.
Searches all elements under this object and returns all objects that match the criteria.
Performs a fling gesture on this object.
direction | The direction in which to fling. |
---|
Performs a fling gesture on this object.
direction | The direction in which to fling. |
---|---|
speed | The speed at which to perform this gesture in pixels per second. |
Returns the package name of the app that this object belongs to.
Returns the number of child elements directly under this object.
Returns a collection of the child elements directly under this object.
Returns the class name of the underlying View
represented by this
object.
Returns the content description for this object.
Returns the fully qualified resource name for this object's id.
Returns the text value for this object.
Returns the visible bounds of this object in screen coordinates.
Returns a point in the center of the visible bounds of this object.
Returns whether there is a match for the given criteria under this object.
Returns whether this object is checkable.
Returns whether this object is checked.
Returns whether this object is clickable.
Returns whether this object is enabled.
Returns whether this object is focusable.
Returns whether this object is focused.
Returns whether this object is long clickable.
Returns whether this object is scrollable.
Returns whether this object is selected.
Performs a long click on this object.
Performs a pinch close gesture on this object.
percent | The size of the pinch as a percentage of this object's size. |
---|---|
speed | The speed at which to perform this gesture in pixels per second. |
Performs a pinch close gesture on this object.
percent | The size of the pinch as a percentage of this object's size. |
---|
Performs a pinch open gesture on this object.
percent | The size of the pinch as a percentage of this object's size. |
---|---|
speed | The speed at which to perform this gesture in pixels per second. |
Performs a pinch open gesture on this object.
percent | The size of the pinch as a percentage of this object's size. |
---|
Recycle this object.
Performs a scroll gesture on this object.
direction | The direction in which to scroll. |
---|---|
percent | The distance to scroll as a percentage of this object's visible size. |
Performs a scroll gesture on this object.
direction | The direction in which to scroll. |
---|---|
percent | The distance to scroll as a percentage of this object's visible size. |
speed | The speed at which to perform this gesture in pixels per second. |
Sets the margins used for gestures in pixels.
Sets the margins used for gestures in pixels.
Sets the text content if this object is an editable field.
Performs a swipe gesture on this object.
direction | The direction in which to swipe. |
---|---|
percent | The length of the swipe as a percentage of this object's size. |
speed | The speed at which to perform this gesture in pixels per second. |
Performs a swipe gesture on this object.
direction | The direction in which to swipe. |
---|---|
percent | The length of the swipe as a percentage of this object's size. |
Waits for given the condition
to be met.
condition | The UiObject2Condition to evaluate. |
---|---|
timeout | Maximum amount of time to wait in milliseconds. |
Waits for given the condition
to be met.
condition | The SearchCondition to evaluate. |
---|---|
timeout | Maximum amount of time to wait in milliseconds. |