assertNotVisible

suspend fun assertNotVisible(tag: String, message: String? = null)

Asserts that a UI element matching string tag is NOT visible on screen.

Automatically polls and waits for the element to disappear if it is currently visible.

Example Usage

assertNotVisible("loading_spinner")

Parameters

tag

The testTag string or visible text of the element.

message

Optional custom assertion error message on failure.

Throws

If the element remains visible after the timeout.


suspend fun assertNotVisible(selector: Selector, message: String? = null, timeoutMs: Long = config.defaultWaitTimeoutMs)

Asserts that a UI element matching selector is NOT visible on screen.

Advanced variant using explicit selectors. Automatically polls until the element disappears.

Example Usage

assertNotVisible(tag("modal_dialog"))

Parameters

selector

Explicit selector targeting the UI element.

message

Optional custom assertion error message.

timeoutMs

Maximum polling duration in milliseconds before failing.

Throws

If the element remains visible after the timeout.