uniqueObject

fun UiDevice.uniqueObject(selector: BySelector, timeout: Duration = DefaultDeviceTimeout): UiObject2(source)

Waits for exactly one object matching selector and returns it.

Fails loudly when the selector is ambiguous, instead of acting on whichever match comes first.

Return

The unique object.

Parameters

selector

Selects the object.

timeout

The nonnegative wait budget for at least one match.

Throws

when nothing matches in time or more than one object matches.