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

ChromeDPTarget

data class ChromeDPTarget

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

When a client wants to interact with a target using CDP, it has to first attach to the target using ChromeDPTarget.attach. This will establish a protocol session to the given target. The client can then interact with the target using the ChromeTargetSession.

Constructors

<init>

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

ChromeDPTarget(id: String, title: String, type: String, description: String, devtoolsFrontendUrl: String, webSocketDebuggerUrl: String)

Properties

description

val description: String

devtoolsFrontendUrl

val devtoolsFrontendUrl: String

id

val id: String

title

val title: String

type

val type: String

webSocketDebuggerUrl

val webSocketDebuggerUrl: String

Functions

attach

Attaches to this target via a new web socket connection to this target's debugger URL. This establishes a new protocol session to this target.

suspend fun attach(webSocketClient: WebSocketClient = DEFAULT_WEBSOCKET_CLIENT): ChromeTargetSession

Extension Functions

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