newPage

abstract suspend fun newPage(viewport: Viewport? = null): Page

Opens a session.

A null viewport gives a one-pixel session: enough for text, the DOM and script, and far cheaper. Pass a real viewport for screenshots and for pages whose behaviour depends on layout. The size is fixed for the life of the session.

Suspends until the session is ready. Cancelling the caller destroys it.

Throws

ErrorCode.MEMORY_LIMIT when the session budget is exhausted, rather than risking an out-of-memory kill.