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

Package org.hildan.chrome.devtools.targets

Types

AbstractTargetSession

A protocol session, created when attached to a target.

sealed class AbstractTargetSession

AllDomainsTarget

Represents the available domain APIs in AllDomains targets

interface AllDomainsTarget

BrowserTarget

Represents the available domain APIs in Browser targets

interface BrowserTarget

ChromeBrowserSession

A browser session, usually created when initially connecting to the browser's debugger.

class ChromeBrowserSession : AbstractTargetSession, BrowserTarget

ChromePageMetaData

data class ChromePageMetaData

ChromePageSession

A page session, usually created when attaching to a page from the root browser session.

class ChromePageSession : AbstractTargetSession, RenderFrameTarget

RenderFrameTarget

Represents the available domain APIs in RenderFrame targets

interface RenderFrameTarget

ServiceWorkerTarget

Represents the available domain APIs in ServiceWorker targets

interface ServiceWorkerTarget

SharedWorkerTarget

Represents the available domain APIs in SharedWorker targets

interface SharedWorkerTarget

WorkerTarget

Represents the available domain APIs in Worker targets

interface WorkerTarget

Functions

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 ChromePageSession.

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

attachToNewPageAndAwaitPageLoad

Creates and attaches to a new page (tab) initially navigated to the given url. Suspends until the frameStoppedLoading event is fired. The underlying web socket connection of this ChromeBrowserSession is reused for the new ChromePageSession.

suspend fun ChromeBrowserSession.attachToNewPageAndAwaitPageLoad(url: String = "about:blank", incognito: Boolean = true, width: Int = 1024, height: Int = 768, background: Boolean = false): ChromePageSession

attachToPage

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

suspend fun ChromeBrowserSession.attachToPage(targetId: TargetID): ChromePageSession

getTargetInfo

Retrieves information about this session's page target.

suspend fun ChromePageSession.getTargetInfo(): TargetInfo

navigateAndAwaitPageLoad

Navigates the current page according to the provided url, and suspends until the corresponding frameStoppedLoading event is received.

suspend fun ChromePageSession.navigateAndAwaitPageLoad(url: String): Unit

Navigates the current page according to the provided navigateRequest, and suspends until the corresponding frameStoppedLoading event is received.

suspend fun ChromePageSession.navigateAndAwaitPageLoad(navigateRequest: NavigateRequest): Unit

use

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

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

Performs the given operation in this session and closes the target.

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

watchTargetsIn

Watches the available targets in this browser.

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