browser resource on the Figranium Kotlin SDK gives you programmatic control over browser sessions. You can open headless or headful sessions, inspect the current headful state, highlight candidate selectors on a page, and stream live selector events during an active headful session.
main.kt
Methods
open
open
Opens a browser session. You can run in headless mode, headful mode, scrape mode, or agent mode.
- HTTP endpoint:
POST /api/browser/open - Signature:
open(input: JsonObject = JsonObject(emptyMap()), options: RequestOptions = RequestOptions()): BrowserSession - Returns:
BrowserSessionwithsessionId,status, and optionallywsEndpoint.
browser_open.kt
highlight
highlight
Highlights candidate selectors on a page and returns a DOM snapshot. Useful for building or debugging selector-based tasks.
- HTTP endpoint:
POST /api/inspector/highlight - Signature:
highlight(input: JsonObject, options: RequestOptions = RequestOptions()): JsonObject - Returns: A
JsonObjectwith selectors and a snapshot.
browser_highlight.kt
stopHeadful
stopHeadful
Stops the active headful browser session.
- HTTP endpoint:
POST /headful/stop - Signature:
stopHeadful(options: RequestOptions = RequestOptions()): JsonObject - Returns:
JsonObject
browser_stop_headful.kt
headfulStatus
headfulStatus
Checks whether the headful session is configured to use noVNC.
- HTTP endpoint:
GET /api/headful/status - Signature:
headfulStatus(options: RequestOptions = RequestOptions()): JsonObject - Returns:
JsonObjectcontaininguseNovncas a boolean.
browser_headful_status.kt
inspect
inspect
Inspects the current headful session and returns diagnostic information.
- HTTP endpoint:
POST /api/headful/inspect - Signature:
inspect(options: RequestOptions = RequestOptions()): JsonObject - Returns:
JsonObject
browser_inspect.kt
vncPassword
vncPassword
Retrieves the VNC password for the current headful session.
- HTTP endpoint:
GET /api/headful/vnc-password - Signature:
vncPassword(options: RequestOptions = RequestOptions()): String - Returns:
Stringcontaining the password.
browser_vnc_password.kt
selectorStream
selectorStream
Streams live selector events from the headful session as a
Flow<StreamEvent<JsonElement>>.- HTTP endpoint:
GET /api/headful/selector_stream - Signature:
selectorStream(options: RequestOptions = RequestOptions()): Flow<StreamEvent<JsonElement>> - Returns:
Flow<StreamEvent<JsonElement>>
This is a server-sent event stream. For details on collecting flows and handling timeouts, see Streaming.
browser_selector_stream.kt
Headful debugging workflow
A typical headful debugging session combines severalBrowserResource methods to open a browser, inspect state, stream selector events, and clean up when finished.
browser_workflow.kt
Related resources
Streaming
Details on
Flow<StreamEvent<JsonElement>>.Request options
Pass custom
headers and per-request timeout overrides.Errors
Handle
FigraniumException responses.Headful Browser
Learn about headful browser sessions in Figranium.
Highlight Tool
Use the highlight tool to build and debug selectors.