Browser

interface Browser

Represents a browser instance that can be controlled programmatically.

This class provides methods to start the browser, navigate to URLs, manage tabs, and handle browser events.

You can create a new instance of this class using the createBrowser method:

fun main() = runBlocking {
val browser = createBrowser(this)
// Use the browser instance to do things...
browser.stop()
}

Inheritors

Properties

Link copied to clipboard
abstract val config: Config

The configuration for the browser instance.

Link copied to clipboard
abstract val connection: Connection?

The connection to the browser's WebSocket debugger.

Link copied to clipboard
abstract val info: ContraDict?
Link copied to clipboard
abstract val mainTab: Tab?

The main tab of the browser.

Link copied to clipboard
abstract val stopped: Boolean

Checks if the browser process has stopped.

Link copied to clipboard
abstract val tabs: List<Tab>

A list of all tabs in the browser.

Link copied to clipboard

A list of targets currently open in the browser.

Link copied to clipboard
abstract val websocketUrl: String

The WebSocket URL for the browser's debugger.

Functions

Link copied to clipboard
abstract suspend fun cleanupTemporaryProfile()
Link copied to clipboard
abstract suspend fun get(url: String = "about:blank", newTab: Boolean = false, newWindow: Boolean = false): Tab

Top level get. Uses the first tab to retrieve given url.

Link copied to clipboard
abstract suspend fun start(): Browser

Launches the actual browser

Link copied to clipboard
abstract suspend fun stop()

Stops the browser process and cleans up resources.

Link copied to clipboard
abstract suspend fun testConnection(): Boolean

Tests the connection to the browser by sending a request to the "version" endpoint.

Link copied to clipboard
abstract suspend fun updateTargets()

Updates the list of targets in the browser.

Link copied to clipboard
abstract suspend fun wait(timeout: Long = 1000): Browser

Waits for the specified time in seconds.