create

suspend fun create(coroutineScope: CoroutineScope, config: Config): Browser

The entry point for creating a new Browser instance.

This function initializes a new Browser instance with the provided configuration. It sets up the necessary parameters such as user data directory, headless mode, browser executable path, and more. It also handles the creation of a coroutine scope for the browser instance and sets up a shutdown hook to clean up resources when the application exits.

Return

A new instance of the Browser class.

Parameters

coroutineScope

The parent CoroutineScope, in which the browser will run.

config

Optional configuration for the browser. If not provided, a default configuration will be used.