Package-level declarations

Types

Link copied to clipboard
interface Browser

Represents a browser instance that can be controlled programmatically.

Link copied to clipboard
data class BrowserSearchConfig(val pathSeparator: String, val searchInPath: Boolean = true, val searchMacosApplications: Boolean = false, val searchWindowsProgramFiles: Boolean = false, val searchLinuxCommonPaths: Boolean = false)

Browser search configuration flags

Link copied to clipboard
interface BrowserTarget
Link copied to clipboard
class Config(userDataDir: Path? = null, val headless: Boolean = Defaults.HEADLESS, val userAgent: String? = null, browserExecutablePath: Path? = null, browserArgs: List<String>? = null, sandbox: Boolean = Defaults.SANDBOX, val lang: String? = null, var host: String? = null, var port: Int? = null, val expert: Boolean = Defaults.EXPERT, val browserConnectionTimeout: Long = Defaults.BROWSER_CONNECTION_TIMEOUT, val browserConnectionMaxTries: Int = Defaults.BROWSER_CONNECTION_MAX_TRIES, val commandTimeout: Long = Defaults.COMMAND_TIMEOUT, val timeBeforeConsideredIdle: Long = Defaults.TIME_BEFORE_CONSIDERED_IDLE, val autoDiscoverTargets: Boolean = Defaults.AUTO_DISCOVER_TARGETS, val debugStringLimit: Int = Defaults.DEBUG_STRING_LIMIT)
Link copied to clipboard

Builder class for creating Config instances using Kotlin DSL syntax.

Link copied to clipboard
@Serializable
data class ContraDict(val webSocketDebuggerUrl: String)
Link copied to clipboard
interface CookieJar

Gives access to the cookies of a Browser, across every tab and window it owns.

Link copied to clipboard
open class DefaultBrowser(val coroutineScope: CoroutineScope, config: Config) : Browser

Default implementation of the Browser interface.

Link copied to clipboard
open class DefaultCookieJar(browser: Browser) : CookieJar

Default CookieJar, talking to the browser over its own connection.

Link copied to clipboard
class HTTPApi(host: String, port: Int)
Link copied to clipboard
expect abstract class Process
actual abstract class Process
actual typealias Process = java.lang.Process
actual abstract class Process
actual abstract class Process
Link copied to clipboard
data class WebSocketInfo(val host: String, val port: Int, val path: String)

Functions

Link copied to clipboard
expect fun addShutdownHook(hook: suspend () -> Unit)
actual fun addShutdownHook(hook: suspend () -> Unit)
actual fun addShutdownHook(hook: suspend () -> Unit)
actual fun addShutdownHook(hook: suspend () -> Unit)
actual fun addShutdownHook(hook: suspend () -> Unit)
Link copied to clipboard
fun config(block: ConfigBuilder.() -> Unit): Config

Creates a Config instance using Kotlin DSL syntax.

Link copied to clipboard
suspend fun createBrowser(coroutineScope: CoroutineScope, config: Config): Browser
suspend fun createBrowser(coroutineScope: CoroutineScope, userDataDir: Path? = null, headless: Boolean = false, userAgent: String? = null, browserExecutablePath: Path? = null, browserArgs: List<String>? = null, sandbox: Boolean = true, lang: String? = null, host: String? = null, port: Int? = null): Browser

The entry point for creating a new Browser instance.

suspend fun createBrowser(coroutineScope: CoroutineScope, block: ConfigBuilder.() -> Unit): Browser

The entry point for creating a new Browser instance using DSL configuration.

Link copied to clipboard
suspend fun Process.destroyAndAwaitExit(gracePeriodMillis: Long, killTimeoutMillis: Long): Boolean

Terminates the process, then waits until it has actually gone.

Link copied to clipboard
expect fun exists(path: Path): Boolean
actual fun exists(path: Path): Boolean
actual fun exists(path: Path): Boolean
actual fun exists(path: Path): Boolean
actual fun exists(path: Path): Boolean
Link copied to clipboard
expect fun Process.exitCodeOrNull(): Int?

Reports the exit status of a process that has already terminated, or null if it is still running (or the platform cannot tell).

actual fun Process.exitCodeOrNull(): Int?
actual fun Process.exitCodeOrNull(): Int?

Reads the exit status, or null while the process is still running.

actual fun Process.exitCodeOrNull(): Int?

Reads the exit status via GetExitCodeProcess, the same call Process.isAlive uses — null while it still reports STILL_ACTIVE.

actual fun Process.exitCodeOrNull(): Int?

Not available on this target: liveness here is kill(pid, 0), which says whether the process exists but never carries its exit status, and nothing reaps the child to collect one.

Link copied to clipboard
expect fun freePort(): Int?
actual fun freePort(): Int?
actual fun freePort(): Int?
actual fun freePort(): Int?
actual fun freePort(): Int?
Link copied to clipboard
expect fun getEnv(name: String): String?
actual fun getEnv(name: String): String?
actual fun getEnv(name: String): String?
actual fun getEnv(name: String): String?
actual fun getEnv(name: String): String?
Link copied to clipboard
expect fun isPosix(): Boolean
actual fun isPosix(): Boolean
actual fun isPosix(): Boolean
actual fun isPosix(): Boolean
actual fun isPosix(): Boolean
Link copied to clipboard
expect fun isRoot(): Boolean
actual fun isRoot(): Boolean
actual fun isRoot(): Boolean
actual fun isRoot(): Boolean
actual fun isRoot(): Boolean
Link copied to clipboard
expect fun Process.killTree()

Forcibly kills the process and, where the platform supports it, its whole tree.

actual fun Process.killTree()
actual fun Process.killTree()

Kills this process and every descendant.

actual fun Process.killTree()
actual fun Process.killTree()

Kills this process with SIGKILL.

Link copied to clipboard
expect suspend fun Process.readStderrSnapshot(maxBytes: Int = 64 * 1024, timeoutMillis: Long = 250): String?

Reads whatever is currently buffered on the process's stderr, or null if unavailable.

actual suspend fun Process.readStderrSnapshot(maxBytes: Int, timeoutMillis: Long): String?
actual suspend fun Process.readStderrSnapshot(maxBytes: Int, timeoutMillis: Long): String?

Reads whatever is currently buffered on the process's stderr, bounded in both size and time.

actual suspend fun Process.readStderrSnapshot(maxBytes: Int, timeoutMillis: Long): String?

Not available on this target: startProcess here calls CreateProcessW without redirecting the child's standard streams, so there is no pipe to read from.

actual suspend fun Process.readStderrSnapshot(maxBytes: Int, timeoutMillis: Long): String?
Link copied to clipboard
expect suspend fun startProcess(exe: Path, params: List<String>): Process
actual suspend fun startProcess(exe: Path, params: List<String>): Process
actual suspend fun startProcess(exe: Path, params: List<String>): Process
actual suspend fun startProcess(exe: Path, params: List<String>): Process
actual suspend fun startProcess(exe: Path, params: List<String>): Process
actual suspend fun startProcess(exe: Path, params: List<String>): Process
Link copied to clipboard
expect fun tempProfileDir(): Path
actual fun tempProfileDir(): Path
actual fun tempProfileDir(): Path
actual fun tempProfileDir(): Path
actual fun tempProfileDir(): Path