waitForReadyState

abstract suspend fun waitForReadyState(until: ReadyState = ReadyState.INTERACTIVE, timeout: Long): Boolean

Waits for the document's ready state to reach a specified state.

This method continuously checks the document's ready state until it matches the specified state or a timeout occurs.

Return

True if the ready state matches the specified state before the timeout, false otherwise.

Parameters

until

The desired ready state to wait for. Can be LOADING, INTERACTIVE, or COMPLETE. Defaults to INTERACTIVE.

Throws

if the timeout is reached before the ready state matches.