BrowserSession

A browser session. This is the root session created when initially connecting to the browser's debugger.

The root browser session doesn't have a session ID.

Properties

Link copied to clipboard
abstract val browser: BrowserDomain

The Browser domain defines methods and events for browser managing.

Link copied to clipboard
abstract val fetch: FetchDomain

A domain for letting clients substitute browser's network layer with client code.

Link copied to clipboard
abstract val io: IODomain

Input/Output operations for streams produced by DevTools.

Link copied to clipboard
Link copied to clipboard
abstract val security: SecurityDomain

Security

Link copied to clipboard
Link copied to clipboard

The SystemInfo domain defines methods and events for querying low-level system information.

Link copied to clipboard
abstract val target: TargetDomain

Supports additional targets discovery and allows to attach to them.

Link copied to clipboard

The Tethering domain defines methods and events for browser port binding.

Link copied to clipboard

Functions

Link copied to clipboard
suspend fun BrowserSession.attachToNewPage(url: String = "about:blank", incognito: Boolean = true, width: Int = 1024, height: Int = 768, background: Boolean = false): PageSession
Link copied to clipboard
suspend fun BrowserSession.attachToNewPageAndAwaitPageLoad(url: String, incognito: Boolean = true, width: Int = 1024, height: Int = 768, background: Boolean = false): PageSession
Link copied to clipboard
Link copied to clipboard
abstract suspend fun attachToTarget(targetId: TargetID): ChildSession

Creates a new ChildSession attached to the target with the given targetId. The new session shares the same underlying web socket connection as this BrowserSession.

Link copied to clipboard
abstract suspend fun close()

Closes this session and the underlying web socket connection. This effectively closes all child sessions, because they're based on the same web socket connection.

Link copied to clipboard
abstract suspend fun closeWebSocket()

Closes the underlying web socket connection, effectively closing every session based on the same web socket connection.

Link copied to clipboard
suspend fun BrowserSession.newPage(configure: NewPageConfigBuilder.() -> Unit = {}): PageSession

Creates a new page and attaches to it, then returns the new child PageSession. The underlying web socket connection of this BrowserSession is reused for the new child PageSession.

Link copied to clipboard
abstract fun unsafe(): AllDomainsTarget

Gives access to all domains of the protocol, regardless of the type of this session.

Link copied to clipboard
inline suspend fun <T> BrowserSession.use(block: (BrowserSession) -> T): T

Performs the given operation in this session and closes the web socket connection.

inline suspend fun <T> BrowserSession.use(block: (BrowserSession) -> T): T
Link copied to clipboard
suspend fun BrowserSession.watchTargetsIn(coroutineScope: CoroutineScope): StateFlow<Map<TargetID, TargetInfo>>