class Configurator


Allows you to set key parameters for running uiautomator tests. The new settings take effect immediately and can be changed any time during a test run. To modify parameters using Configurator, first obtain an instance by calling getInstance. As a best practice, make sure you always save the original value of any parameter that you are modifying. After running your tests with the modified parameters, make sure to also restore the original parameter values, otherwise this will impact other tests cases.

Summary

Public functions

Long

Gets the current timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses.

java-static Configurator

Retrieves a singleton instance of Configurator.

Long

Gets the current delay between key presses when injecting text input.

Long

Gets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action.

Int

Gets the current tool type to use for motion events.

Int

Gets the current flags that are used to obtain a android.app.UiAutomation instance.

Long

Gets the current timeout used for waiting for the user interface to go into an idle state.

Long

Gets the current timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector.

Configurator

Sets the timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses.

Configurator

Sets a delay between key presses when injecting text input.

Configurator

Sets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action.

Configurator
setToolType(toolType: Int)

Sets the current tool type to use for motion events.

Configurator

Sets the flags to use when obtaining a android.app.UiAutomation instance.

Configurator

Sets the timeout for waiting for the user interface to go into an idle state before starting a uiautomator action.

Configurator

Sets the timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector.

Public functions

getActionAcknowledgmentTimeout

fun getActionAcknowledgmentTimeout(): Long

Gets the current timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses. The acknowledgment is an AccessibilityEvent, corresponding to an action, that lets the framework determine if the action was successful. Generally, this timeout should not be modified. See UiObject

Returns
Long

current timeout in milliseconds

getInstance

java-static fun getInstance(): Configurator

Retrieves a singleton instance of Configurator.

Returns
Configurator

Configurator instance

getKeyInjectionDelay

fun getKeyInjectionDelay(): Long

Gets the current delay between key presses when injecting text input. See setText

Returns
Long

current delay in milliseconds

getScrollAcknowledgmentTimeout

fun getScrollAcknowledgmentTimeout(): Long

Gets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action. The acknowledgment is an AccessibilityEvent, corresponding to the scroll action, that lets the framework determine if the scroll action was successful. Generally, this timeout should not be modified. See UiScrollable

Returns
Long

current timeout in milliseconds

getToolType

fun getToolType(): Int

Gets the current tool type to use for motion events.

See also
getToolType

getUiAutomationFlags

fun getUiAutomationFlags(): Int

Gets the current flags that are used to obtain a android.app.UiAutomation instance.

Returns
Int

The UiAutomation flags.

getWaitForIdleTimeout

fun getWaitForIdleTimeout(): Long

Gets the current timeout used for waiting for the user interface to go into an idle state. By default, all core uiautomator objects except UiDevice will perform this wait before starting to search for the widget specified by the object's UiSelector. Once the idle state is detected or the timeout elapses (whichever occurs first), the object will start to wait for the selector to find a match. See setWaitForSelectorTimeout

Returns
Long

Current timeout value in milliseconds

getWaitForSelectorTimeout

fun getWaitForSelectorTimeout(): Long

Gets the current timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector. Because user interface content is dynamic, sometimes a widget may not be visible immediately and won't be detected by a selector. This timeout allows the uiautomator framework to wait for a match to be found, up until the timeout elapses.

Returns
Long

Current timeout value in milliseconds

setActionAcknowledgmentTimeout

fun setActionAcknowledgmentTimeout(timeout: Long): Configurator

Sets the timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses. The acknowledgment is an AccessibilityEvent, corresponding to an action, that lets the framework determine if the action was successful. Generally, this timeout should not be modified. See UiObject

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self

setKeyInjectionDelay

fun setKeyInjectionDelay(delay: Long): Configurator

Sets a delay between key presses when injecting text input. See setText

Parameters
delay: Long

Delay value in milliseconds

Returns
Configurator

self

setScrollAcknowledgmentTimeout

fun setScrollAcknowledgmentTimeout(timeout: Long): Configurator

Sets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action. The acknowledgment is an AccessibilityEvent, corresponding to the scroll action, that lets the framework determine if the scroll action was successful. Generally, this timeout should not be modified. See UiScrollable

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self

setToolType

fun setToolType(toolType: Int): Configurator

Sets the current tool type to use for motion events.

setUiAutomationFlags

fun setUiAutomationFlags(flags: Int): Configurator

Sets the flags to use when obtaining a android.app.UiAutomation instance.

Parameters
flags: Int

The UiAutomation flags to use.

Returns
Configurator

A reference to this object.

setWaitForIdleTimeout

fun setWaitForIdleTimeout(timeout: Long): Configurator

Sets the timeout for waiting for the user interface to go into an idle state before starting a uiautomator action. By default, all core uiautomator objects except UiDevice will perform this wait before starting to search for the widget specified by the object's UiSelector. Once the idle state is detected or the timeout elapses (whichever occurs first), the object will start to wait for the selector to find a match. See setWaitForSelectorTimeout

Parameters
timeout: Long

Timeout value in milliseconds

Returns
Configurator

self

setWaitForSelectorTimeout

fun setWaitForSelectorTimeout(timeout: Long): Configurator

Sets the timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector. Because user interface content is dynamic, sometimes a widget may not be visible immediately and won't be detected by a selector. This timeout allows the uiautomator framework to wait for a match to be found, up until the timeout elapses.

Parameters
timeout: Long

Timeout value in milliseconds.

Returns
Configurator

self