chrome-devtools-kotlin / org.hildan.chrome.devtools.protocol

Package org.hildan.chrome.devtools.protocol

Types

ChromeBrowserSession

class ChromeBrowserSession : ChromeDPSession

ChromeDPClient

A Chrome Devtools Protocol client.

class ChromeDPClient

ChromeDPSession

open class ChromeDPSession

ChromeDPTarget

Targets are the parts of the browser that the Chrome DevTools Protocol can interact with. This includes for instance pages, serviceworkers and extensions.

data class ChromeDPTarget

ChromeTargetSession

class ChromeTargetSession : ChromeDPSession

ChromeVersion

data class ChromeVersion

RequestError

Represents protocol error.

data class RequestError

RequestFrame

Represents a request frame, as defined in the protocol's README

data class RequestFrame

Exceptions

MissingResponse

class MissingResponse : Exception

RequestFailed

class RequestFailed : Exception

Functions

attachTo

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

suspend fun ChromeBrowserSession.attachTo(targetId: TargetID, browserContextID: BrowserContextID? = null): ChromeTargetSession

attachToNewPage

Creates and attaches to a new page (tab) initially navigated to the given url. The underlying web socket connection of this ChromeBrowserSession is reused for the new ChromeTargetSession.

suspend fun ChromeBrowserSession.attachToNewPage(url: String, incognito: Boolean = true, width: Int = 1024, height: Int = 768, background: Boolean = false): ChromeTargetSession

use

Attaches to this target via a new web socket connection, and performs the given operation before closing the connection.

suspend fun <T> ChromeDPTarget.use(block: (ChromeTargetSession) -> T): T

watchTargetsIn

Watches the available targets in this browser.

fun ChromeBrowserSession.watchTargetsIn(coroutineScope: CoroutineScope): StateFlow<Map<TargetID, TargetInfo>>