Sign in

    mizchi/crater-webdriver-bidi/webdriver does not have a README file

    ApiError

    pub(all) enum ApiError {
    ElementNotFound(String)
    PageNotFound(String)
    ContextNotFound(String)
    Timeout(String)
    NavigationFailed(String, String)
    ElementNotVisible(String)
    ElementNotEnabled(String)
    EvalError(String)
    InvalidArgument(String)
    NotSupported(String)
    InternalError(String)
    } derive(
    Debug
    )

    API error
    impl Show for ApiError

    ApiMethod

    pub(all) enum ApiMethod {
    NewContext
    CloseContext(String)
    NewPage(String)
    ClosePage(String)
    Pages(String)
    Goto(String, String)
    GoBack(String)
    GoForward(String)
    Reload(String)
    Url(String)
    Title(String)
    Query(String, String)
    QueryAll(String, String)
    WaitFor(String, String, Int)
    BoundingBox(String)
    TextContent(String)
    InnerText(String)
    InnerHtml(String)
    GetAttribute(String, String)
    IsVisible(String)
    IsEnabled(String)
    IsChecked(String)
    Click(String)
    DblClick(String)
    RightClick(String)
    Hover(String)
    Focus(String)
    Fill(String, String)
    Press(String, String)
    Clear(String)
    SelectOption(String, String)
    Check(String)
    Uncheck(String)
    MouseMove(String, Double, Double)
    MouseClick(String, Double, Double, String)
    MouseDown(String, String)
    MouseUp(String, String)
    KeyboardPress(String, String)
    KeyboardType(String, String)
    Content(String)
    SetContent(String, String)
    ViewportSize(String)
    SetViewportSize(String, Int, Int)
    Evaluate(String, String)
    Screenshot(String)
    ElementScreenshot(String)
    AccessibilitySnapshot(String)
    } derive(
    Debug
    )

    All API methods as an enum for JSON-RPC dispatch
    impl Show for ApiMethod

    ApiResult

    pub(all) enum ApiResult[T] {
    Ok(T)
    Err(ApiError)
    } derive(
    Debug
    )

    API result - success or error

    BidiServer

    pub struct BidiServer {
    config : BidiServerConfig
    server :
    Any
    ?
    // private fields
    }

    BiDi server state

    BidiServer::new

    fn BidiServer::new(config? : BidiServerConfig) -> BidiServer

    Create new BiDi server

    BidiServer::start

    fn BidiServer::start(self : BidiServer) -> Unit

    Start the BiDi server using Deno.serve

    BidiServer::stop

    fn BidiServer::stop(self : BidiServer) -> Unit

    Stop the server

    BidiServerConfig

    pub(all) struct BidiServerConfig {
    host : String
    port : Int
    auth_token : String
    }

    BiDi server configuration

    BidiServerConfig::default

    Default configuration (generates a random auth token)

    BidiServerConfig::web_socket_url

    fn BidiServerConfig::web_socket_url(self : BidiServerConfig) -> String

    Capabilities

    pub(all) struct Capabilities {
    browser_name : String
    browser_version : String
    platform_name : String
    accept_insecure_certs : Bool
    page_load_strategy : PageLoadStrategy
    proxy : ProxyConfig?
    timeouts : Timeouts
    } derive(
    Debug
    )

    Browser capabilities

    Capabilities::to_json

    fn Capabilities::to_json(self : Capabilities) -> String

    Serialize Capabilities to JSON string

    CdpHandlerError

    pub enum CdpHandlerError {
    NoSuchElement(String)
    InvalidSelector(String)
    NavigationFailed(String, String)
    InternalCdpError(String)
    } derive(
    Debug
    )

    CDP Handler errors

    CdpHandlerError::to_w3c_error

    fn CdpHandlerError::to_w3c_error(self : CdpHandlerError) -> (String, String)

    Convert CdpHandlerError to W3C error format

    CdpSessionManager

    pub struct CdpSessionManager {
    sessions : Map[String,
    CdpSession
    ]
    next_id : Int
    }

    Manages CDP sessions for WebDriver

    CdpSessionManager::close_session

    fn CdpSessionManager::close_session(self : CdpSessionManager, session_id : String) -> Bool

    Close a session

    CdpSessionManager::create_session

    fn CdpSessionManager::create_session(self : CdpSessionManager) -> String

    Create a new CDP session

    CdpSessionManager::create_session_with_id

    fn CdpSessionManager::create_session_with_id(self : CdpSessionManager, session_id : String) -> String

    Recreate a CDP session with a caller-provided session id.

    CdpSessionManager::get_session

    Get a session by ID

    CdpSessionManager::has_session

    fn CdpSessionManager::has_session(self : CdpSessionManager, session_id : String) -> Bool

    Check if a session exists

    CdpSessionManager::list_sessions

    fn CdpSessionManager::list_sessions(self : CdpSessionManager) -> Array[String]

    List all session IDs

    CdpSessionManager::new

    Create a new CDP session manager

    ContextId

    pub(all) struct ContextId {
    id : String
    } derive(Eq,
    Debug
    )

    Unique identifier for browser contexts

    ElementId

    pub(all) struct ElementId {
    id : String
    } derive(Eq,
    Debug
    )

    Unique identifier for browser elements

    ElementRect

    pub(all) struct ElementRect {
    x : Double
    y : Double
    width : Double
    height : Double
    } derive(
    Debug
    )

    Element rectangle (with floating point)

    ElementRect::to_json

    fn ElementRect::to_json(self : ElementRect) -> String

    Serialize ElementRect to JSON string

    ErrorCode

    pub(all) enum ErrorCode {
    ElementClickIntercepted
    ElementNotInteractable
    InsecureCertificate
    InvalidArgument
    InvalidCookieDomain
    InvalidElementState
    InvalidSelector
    InvalidSessionId
    JavascriptError
    MoveTargetOutOfBounds
    NoSuchAlert
    NoSuchCookie
    NoSuchElement
    NoSuchFrame
    NoSuchWindow
    ScriptTimeout
    SessionNotCreated
    StaleElementReference
    Timeout
    UnableToSetCookie
    UnableToCaptureScreen
    UnexpectedAlertOpen
    UnknownCommand
    UnknownError
    UnknownMethod
    UnsupportedOperation
    } derive(Eq,
    Debug
    )

    WebDriver error codes as defined in W3C spec

    ErrorCode::http_status

    fn ErrorCode::http_status(self : ErrorCode) -> Int

    HTTP status code for error

    ErrorCode::to_string

    fn ErrorCode::to_string(self : ErrorCode) -> String

    Convert error code to string

    Executor

    pub struct Executor {
    manager : CdpSessionManager
    logging_enabled : Bool
    operation_log : Array[String]
    }

    Execution context with logging and state management

    Executor::clear_log

    fn Executor::clear_log(self : Executor) -> Unit

    Clear operation log

    Executor::close_context

    fn Executor::close_context(self : Executor, context_id : String) -> ApiResult[String]

    Close a browser context

    Executor::content

    fn Executor::content(self : Executor, page_id : String) -> ApiResult[String]

    Get page content

    Executor::disable_logging

    fn Executor::disable_logging(self : Executor) -> Unit

    Disable operation logging

    Executor::enable_logging

    fn Executor::enable_logging(self : Executor) -> Unit

    Enable operation logging

    Executor::execute

    fn Executor::execute(self : Executor, api_method : ApiMethod) -> ApiResult[String]

    Execute an API method and return result This is THE central entry point for all browser operations.

    Executor::execute_json

    fn Executor::execute_json(self : Executor, json : String) -> String

    Execute from JSON-RPC request string

    Executor::get_log

    fn Executor::get_log(self : Executor) -> Array[String]

    Get operation log

    Executor::go_back

    fn Executor::go_back(self : Executor, page_id : String) -> ApiResult[String]

    Go back in history

    Executor::go_forward

    fn Executor::go_forward(self : Executor, page_id : String) -> ApiResult[String]

    Go forward in history

    Executor::goto

    fn Executor::goto(self : Executor, page_id : String, url : String) -> ApiResult[String]

    Navigate to URL

    Executor::new

    fn Executor::new() -> Executor

    Create a new executor

    Executor::new_context

    fn Executor::new_context(self : Executor) -> ApiResult[String]

    Create a new browser context

    Executor::new_with_viewport

    fn Executor::new_with_viewport(_width : Int, _height : Int) -> Executor

    Create executor with custom viewport (viewport info stored but not used in pure protocol mode)

    Executor::reload

    fn Executor::reload(self : Executor, page_id : String) -> ApiResult[String]

    Reload page

    Executor::screenshot

    fn Executor::screenshot(self : Executor, page_id : String) -> ApiResult[String]

    Get screenshot (DOM tree as text in pure protocol mode)

    Executor::title

    fn Executor::title(self : Executor, page_id : String) -> ApiResult[String]

    Get page title

    Executor::url

    fn Executor::url(self : Executor, page_id : String) -> ApiResult[String]

    Get current URL

    HttpMethod

    pub(all) enum HttpMethod {
    Get
    Post
    Delete
    } derive(Eq,
    Debug
    )

    HTTP method

    LocatorStrategy

    pub(all) enum LocatorStrategy {
    CssSelector
    LinkText
    PartialLinkText
    TagName
    XPath
    } derive(Eq,
    Debug
    )

    Element location strategy

    LocatorStrategy::from_string

    fn LocatorStrategy::from_string(s : String) -> LocatorStrategy?

    Parse strategy from string

    LocatorStrategy::to_string

    fn LocatorStrategy::to_string(self : LocatorStrategy) -> String

    Convert strategy to string

    Modifiers

    pub(all) struct Modifiers {
    ctrl : Bool
    shift : Bool
    alt : Bool
    meta : Bool
    } derive(
    Debug
    )

    Keyboard modifier keys

    Modifiers::none

    fn Modifiers::none() -> Modifiers

    Default modifiers (none pressed)

    MouseButton

    pub(all) enum MouseButton {
    Left
    Right
    Middle
    } derive(Eq,
    Debug
    )

    Mouse button

    PageId

    pub(all) struct PageId {
    id : String
    } derive(Eq,
    Debug
    )

    Unique identifier for browser pages/tabs

    PageLoadStrategy

    pub(all) enum PageLoadStrategy {
    None
    Eager
    Normal
    } derive(Eq,
    Debug
    )

    Page load strategy

    PageLoadStrategy::to_json_string

    fn PageLoadStrategy::to_json_string(self : PageLoadStrategy) -> String

    Page load strategy to JSON string value

    Point

    pub(all) struct Point {
    x : Double
    y : Double
    } derive(
    Debug
    )

    Point in 2D space

    ProxyConfig

    pub(all) struct ProxyConfig {
    proxy_type : String
    proxy_autoconfig_url : String?
    ftp_proxy : String?
    http_proxy : String?
    no_proxy : Array[String]
    ssl_proxy : String?
    socks_proxy : String?
    socks_version : Int?
    } derive(
    Debug
    )

    Proxy configuration

    Rect

    pub(all) struct Rect {
    x : Double
    y : Double
    width : Double
    height : Double
    } derive(
    Debug
    )

    Rectangle with position and size

    RpcErrorCode

    pub(all) enum RpcErrorCode {
    ParseError
    InvalidRequest
    MethodNotFound
    InvalidParams
    InternalError
    ElementNotFound
    PageNotFound
    Timeout
    NavigationFailed
    } derive(Eq,
    Debug
    )

    Standard JSON-RPC error codes

    RpcErrorCode::code

    fn RpcErrorCode::code(self : RpcErrorCode) -> Int

    Get numeric error code

    RpcId

    pub(all) enum RpcId {
    Num(Int)
    Str(String)
    Null
    } derive(Eq,
    Debug
    )

    JSON-RPC request ID (can be string or number)
    impl Show for RpcId

    RpcId::to_json

    fn RpcId::to_json(self : RpcId) -> String

    Serialize RpcId to JSON

    RpcRequest

    pub(all) struct RpcRequest {
    jsonrpc : String
    id : RpcId
    method_name : String
    params : Map[String, String]
    } derive(
    Debug
    )

    JSON-RPC request
    impl Show for RpcRequest

    RpcResponse

    pub(all) enum RpcResponse {
    Success(RpcId, String)
    Error(RpcId, Int, String, String?)
    } derive(
    Debug
    )

    JSON-RPC response
    impl Show for RpcResponse

    RpcResponse::to_json

    fn RpcResponse::to_json(self : RpcResponse) -> String

    Serialize RpcResponse to JSON

    Selector

    pub(all) enum Selector {
    Css(String)
    XPath(String)
    Text(String)
    TextContains(String)
    Role(String, String?)
    TestId(String)
    Label(String)
    Placeholder(String)
    AltText(String)
    Title(String)
    } derive(
    Debug
    )

    Element selector strategy

    Selector::to_string

    fn Selector::to_string(self : Selector) -> String

    Convert selector to string representation

    Session

    pub(all) struct Session {
    id : String
    capabilities : Capabilities
    } derive(
    Debug
    )

    Session information

    Session::to_json

    fn Session::to_json(self : Session) -> String

    Serialize Session to JSON string

    SessionManager

    pub(all) struct SessionManager {
    sessions : Map[String, SessionState]
    next_id : Int
    }

    Session manager

    SessionManager::create_session

    fn SessionManager::create_session(self : SessionManager, _body : String) -> WebDriverResponse

    Create a new session

    SessionManager::delete_session

    fn SessionManager::delete_session(self : SessionManager, session_id : String) -> WebDriverResponse

    Delete a session

    SessionManager::generate_id

    fn SessionManager::generate_id(self : SessionManager) -> String

    Generate new session ID

    SessionManager::get_session

    fn SessionManager::get_session(self : SessionManager, session_id : String) -> SessionState?

    Get session state

    SessionManager::handle_request

    fn SessionManager::handle_request(self : SessionManager, request : WebDriverRequest) -> (Int, WebDriverResponse)

    Handle WebDriver request

    SessionManager::new

    Create new session manager

    SessionState

    pub(all) struct SessionState {
    id : String
    capabilities : Capabilities
    current_url : String
    title : String
    window_rect : WindowRect
    }

    Session state

    Timeouts

    pub(all) struct Timeouts {
    script : Int
    page_load : Int
    implicit : Int
    } derive(
    Debug
    )

    Timeout settings

    Timeouts::default

    fn Timeouts::default() -> Timeouts

    Default timeouts

    Timeouts::to_json

    fn Timeouts::to_json(self : Timeouts) -> String

    Serialize Timeouts to JSON string

    Viewport

    pub(all) struct Viewport {
    width : Int
    height : Int
    } derive(
    Debug
    )

    Viewport size

    WebDriverCommand

    pub(all) enum WebDriverCommand {
    Status
    NewSession
    DeleteSession(String)
    GetSession(String)
    GetTimeouts(String)
    SetTimeouts(String)
    NavigateTo(String)
    GetCurrentUrl(String)
    Back(String)
    Forward(String)
    Refresh(String)
    GetTitle(String)
    GetWindowHandle(String)
    CloseWindow(String)
    SwitchToWindow(String)
    GetWindowHandles(String)
    NewWindow(String)
    SwitchToFrame(String)
    SwitchToParentFrame(String)
    GetWindowRect(String)
    SetWindowRect(String)
    MaximizeWindow(String)
    MinimizeWindow(String)
    FullscreenWindow(String)
    FindElement(String)
    FindElements(String)
    FindElementFromElement(String, String)
    FindElementsFromElement(String, String)
    GetActiveElement(String)
    IsElementSelected(String, String)
    GetElementAttribute(String, String, String)
    GetElementProperty(String, String, String)
    GetElementCssValue(String, String, String)
    GetElementText(String, String)
    GetElementTagName(String, String)
    GetElementRect(String, String)
    IsElementEnabled(String, String)
    ElementClick(String, String)
    ElementClear(String, String)
    ElementSendKeys(String, String)
    GetPageSource(String)
    ExecuteScript(String)
    ExecuteAsyncScript(String)
    GetAllCookies(String)
    GetNamedCookie(String, String)
    AddCookie(String)
    DeleteCookie(String, String)
    DeleteAllCookies(String)
    PerformActions(String)
    ReleaseActions(String)
    DismissAlert(String)
    AcceptAlert(String)
    GetAlertText(String)
    SendAlertText(String)
    TakeScreenshot(String)
    TakeElementScreenshot(String, String)
    PrintPage(String)
    Unknown(String)
    } derive(
    Debug
    )

    WebDriver commands (endpoints)

    WebDriverError

    pub(all) struct WebDriverError {
    error : ErrorCode
    message : String
    stacktrace : String
    } derive(
    Debug
    )

    WebDriver error response

    WebDriverError::to_json

    fn WebDriverError::to_json(self : WebDriverError) -> String

    Serialize WebDriverError to JSON string

    WebDriverRequest

    pub(all) struct WebDriverRequest {
    http_method : HttpMethod
    command : WebDriverCommand
    body : String
    } derive(
    Debug
    )

    Parsed WebDriver command from HTTP request

    WebDriverResponse

    pub(all) enum WebDriverResponse {
    Success(WebDriverValue)
    Error(WebDriverError)
    } derive(
    Debug
    )

    WebDriver response (success or error)

    WebDriverResponse::to_json

    fn WebDriverResponse::to_json(self : WebDriverResponse) -> String

    Serialize WebDriverResponse to JSON string

    WebDriverValue

    pub(all) enum WebDriverValue {
    Null
    Bool(Bool)
    String(String)
    Number(Double)
    Array(Array[WebDriverValue])
    Object(Map[String, WebDriverValue])
    Element(String)
    } derive(
    Debug
    )

    WebDriver success value

    WebDriverValue::to_json

    fn WebDriverValue::to_json(self : WebDriverValue) -> String

    Serialize WebDriverValue to JSON string

    WindowRect

    pub(all) struct WindowRect {
    x : Int
    y : Int
    width : Int
    height : Int
    } derive(
    Debug
    )

    Window rectangle

    WindowRect::to_json

    fn WindowRect::to_json(self : WindowRect) -> String

    Serialize WindowRect to JSON string

    api_error_to_rpc

    fn api_error_to_rpc(id : RpcId, err : ApiError) -> RpcResponse

    Convert ApiError to RpcResponse

    await_promise

    fn await_promise(promise :
    Any
    ) -> String

    Await a Promise and return result as String

    decode_base64

    fn decode_base64(base64 : String) -> String

    Decode base64 string

    delete_runtime_handle

    fn delete_runtime_handle(handle_id : String) -> Unit

    Remove handle from current JS handle store (no-op when absent).

    error_response

    fn error_response(code : ErrorCode, message : String) -> WebDriverResponse

    Create error response

    eval_and_send_async

    fn eval_and_send_async(socket :
    Any
    , request_id : Int, expression : String, ctx_id : String) -> Unit

    Evaluate expression asynchronously and send result via WebSocket

    evaluate_js

    fn evaluate_js(expression : String) -> String

    Evaluate JavaScript expression and return result as JSON (sync)

    evaluate_js_async

    fn evaluate_js_async(expression : String) ->
    Any

    Evaluate JavaScript expression asynchronously (awaits Promise if awaitPromise=true) Returns a Promise (@core.Any) that resolves to JSON string

    generate_auth_token

    fn generate_auth_token() -> String

    get_runtime_anchor_download_attr_by_id

    fn get_runtime_anchor_download_attr_by_id(anchor_id : String) -> String?

    Resolve download attribute value from an anchor identified by id or global symbol.

    get_runtime_anchor_href_by_id

    fn get_runtime_anchor_href_by_id(anchor_id : String) -> String?

    Resolve absolute href from an anchor identified by id or global symbol.

    get_runtime_href_at_point

    fn get_runtime_href_at_point(x : Double, y : Double) -> String?

    Resolve href from element under viewport coordinates.

    get_runtime_iframe_sources

    fn get_runtime_iframe_sources() -> Array[String]

    Collect iframe src values from runtime document.

    get_runtime_inline_navigation_url

    fn get_runtime_inline_navigation_url(attribute_name : String) -> String?

    Resolve data/absolute URL assigned by inline event handlers like onkeydown/onmousedown.

    get_runtime_last_click_href

    fn get_runtime_last_click_href() -> String?

    Resolve href from the most recent synthetic click target.

    get_runtime_shared_node_at_point

    fn get_runtime_shared_node_at_point(x : Double, y : Double) -> String?

    Resolve shared node at viewport point, allocating sharedId if needed.

    get_runtime_shared_node_center_json

    fn get_runtime_shared_node_center_json(shared_id : String) -> String

    Get center coordinate of shared element as JSON string.

    get_runtime_shared_node_href

    fn get_runtime_shared_node_href(shared_id : String) -> String?

    Resolve href attribute from a shared element node.

    get_runtime_url_query_param

    fn get_runtime_url_query_param(url : String, key : String) -> String?

    Extract query parameter value from an URL string.

    handle_element_click

    fn handle_element_click(session :
    CdpSession
    , element_id : Int) -> Result[Unit, CdpHandlerError]

    Handle element click via CDP

    handle_find_element

    fn handle_find_element(session :
    CdpSession
    , strategy : String, value : String) -> Result[Int, CdpHandlerError]

    Handle findElement via CDP

    handle_find_elements

    fn handle_find_elements(session :
    CdpSession
    , strategy : String, value : String) -> Result[Array[Int], CdpHandlerError]

    Handle findElements via CDP

    handle_get_current_url

    fn handle_get_current_url(session :
    CdpSession
    ) -> String

    Handle getCurrentUrl via CDP

    handle_get_element_attribute

    fn handle_get_element_attribute(session :
    CdpSession
    , element_id : Int, name : String) -> Result[String?, CdpHandlerError]

    Handle getElementAttribute via CDP

    handle_get_element_tag_name

    fn handle_get_element_tag_name(session :
    CdpSession
    , element_id : Int) -> Result[String, CdpHandlerError]

    Handle getElementTagName via CDP

    handle_get_element_text

    fn handle_get_element_text(session :
    CdpSession
    , element_id : Int) -> Result[String, CdpHandlerError]

    Handle getElementText via CDP

    handle_get_title

    fn handle_get_title(session :
    CdpSession
    ) -> String

    Handle getTitle via CDP

    handle_navigate

    fn handle_navigate(session :
    CdpSession
    , url : String) -> Result[Unit, CdpHandlerError]

    Handle navigation via CDP

    handle_rpc

    fn handle_rpc(manager : CdpSessionManager, request : RpcRequest) -> RpcResponse

    Handle an RPC request and return a response This is the main entry point for processing JSON-RPC requests

    has_runtime_handle

    fn has_runtime_handle(handle_id : String) -> Bool

    Check if runtime handle exists in current JS handle store.

    has_runtime_shared_node

    fn has_runtime_shared_node(shared_id : String) -> Bool

    Check if runtime shared node exists in current JS shared node store.

    init_quickjs

    fn init_quickjs() ->
    Any

    Initialize QuickJS runtime Returns a promise that resolves when initialization is complete

    input_clear_drag_transfer

    fn input_clear_drag_transfer(drag_transfer_id : String) -> Unit

    input_clear_pointer_event_properties

    fn input_clear_pointer_event_properties() -> Unit

    Clear synthetic pointer event property overrides.

    input_dispatch_drag_event

    fn input_dispatch_drag_event(shared_id : String, event_type : String, x : Double, y : Double, button : Int, buttons : Int, pointer_type : String, ctrl : Bool, alt : Bool, shift : Bool, meta : Bool, related_shared_id : String, drag_transfer_id : String) -> Bool

    input_dispatch_key_action

    fn input_dispatch_key_action(action_type : String, raw_value : String, ctrl : Bool, alt : Bool, shift : Bool, meta : Bool) -> Unit

    Dispatch synthetic keyboard event and keep allEvents in sync for WPT pages.

    input_dispatch_pointer_event

    fn input_dispatch_pointer_event(shared_id : String, event_type : String, x : Double, y : Double, button : Int, buttons : Int, pointer_type : String, ctrl : Bool, alt : Bool, shift : Bool, meta : Bool) -> Unit

    Dispatch synthetic pointer/mouse event.
    fn input_dispatch_pointer_event_with_related(shared_id : String, event_type : String, x : Double, y : Double, button : Int, buttons : Int, pointer_type : String, ctrl : Bool, alt : Bool, shift : Bool, meta : Bool, related_shared_id : String) -> Unit

    input_dispatch_wheel_event

    fn input_dispatch_wheel_event(shared_id : String, x : Double, y : Double, delta_x : Double, delta_y : Double, ctrl : Bool, alt : Bool, shift : Bool, meta : Bool) -> Unit

    Dispatch synthetic wheel event.

    input_drag_transfer_state

    fn input_drag_transfer_state(drag_transfer_id : String) -> String

    input_is_mac_platform

    fn input_is_mac_platform() -> Bool

    Detect whether current runtime should emulate macOS pointer conventions.

    input_is_single_grapheme

    fn input_is_single_grapheme(value : String) -> Bool

    Check whether string contains exactly one grapheme cluster.

    input_now_ms

    fn input_now_ms() -> Double

    Current wall-clock timestamp in milliseconds.

    input_set_pointer_event_properties

    fn input_set_pointer_event_properties(width : Double, height : Double, pressure : Double, tangential_pressure : Double, twist : Double, altitude_angle : Double, azimuth_angle : Double) -> Unit

    Set synthetic pointer event property overrides used by pointer dispatch.

    is_quickjs_initialized

    fn is_quickjs_initialized() -> Bool

    Check if QuickJS is initialized

    mark_quickjs_initialized

    fn mark_quickjs_initialized() -> Unit

    Mark QuickJS as initialized (call after awaiting init_quickjs)

    parse_data_url

    fn parse_data_url(url : String) -> (String, String)?

    Parse data URL and return decoded content Returns (content_type, content) or None if invalid

    parse_json_object

    fn parse_json_object(json : String) -> Map[String, String]

    Parse a simple JSON object into a Map Note: This is a very simplified parser for demo purposes

    parse_method

    fn parse_method(name : String) -> ApiMethod?

    Parse method name to ApiMethod

    parse_request

    fn parse_request(method_str : String, path : String, body : String) -> WebDriverRequest

    Parse HTTP request into WebDriverRequest

    quickjs_eval_async

    fn quickjs_eval_async(expression : String, await_promise : Bool) ->
    Any

    Evaluate expression using QuickJS (async) Returns a promise that resolves to BiDi-formatted JSON

    quickjs_eval_module

    fn quickjs_eval_module(code : String) ->
    Any

    Evaluate ES module using QuickJS Returns a promise that resolves to BiDi-formatted JSON

    quickjs_eval_sync

    fn quickjs_eval_sync(expression : String) -> String

    Evaluate expression using QuickJS (sync - not recommended, use async)

    quickjs_eval_ws

    fn quickjs_eval_ws(socket :
    Any
    , request_id : Int, expression : String, ctx_id : String) -> Unit

    Evaluate expression and send result via WebSocket

    quickjs_fetch

    fn quickjs_fetch(url : String) ->
    Any

    Fetch URL and load into QuickJS Returns a promise that resolves to result JSON

    quickjs_load

    fn quickjs_load(html : String) ->
    Any

    Load HTML into QuickJS Mock DOM Returns a promise that resolves to result JSON

    reset_paint_provider

    fn reset_paint_provider() -> Unit

    Reset paint provider state on new WebSocket session. Must be called when JS runtime is reset to avoid stale glyph provider.

    reset_runtime_event_buffers

    fn reset_runtime_event_buffers(ctx_id : String) -> Unit

    Reset runtime event buffers/listeners for a specific context.

    rpc_error

    fn rpc_error(id : RpcId, code : RpcErrorCode, message : String) -> RpcResponse

    Create error response

    rpc_error_with_data

    fn rpc_error_with_data(id : RpcId, code : RpcErrorCode, message : String, data : String) -> RpcResponse

    Create error response with data

    rpc_success_bool

    fn rpc_success_bool(id : RpcId, value : Bool) -> RpcResponse

    Create success response with bool result

    rpc_success_json

    fn rpc_success_json(id : RpcId, json : String) -> RpcResponse

    Create success response with raw JSON result

    rpc_success_null

    fn rpc_success_null(id : RpcId) -> RpcResponse

    Create success response with null result

    rpc_success_number

    fn rpc_success_number(id : RpcId, value : Double) -> RpcResponse

    Create success response with number result

    rpc_success_string

    fn rpc_success_string(id : RpcId, value : String) -> RpcResponse

    Create success response with string result

    runtime_shared_node_is_document

    fn runtime_shared_node_is_document(shared_id : String) -> Bool

    Check if runtime shared node exists and is a document node.

    runtime_shared_node_is_draggable

    fn runtime_shared_node_is_draggable(shared_id : String) -> Bool

    Check if runtime shared node has draggable attribute enabled.

    runtime_shared_node_is_element

    fn runtime_shared_node_is_element(shared_id : String) -> Bool

    Check if runtime shared node exists and is an element node.

    runtime_shared_node_is_shadow_root

    fn runtime_shared_node_is_shadow_root(shared_id : String) -> Bool

    Check if runtime shared node exists and is a shadow root node.

    runtime_write_text_file

    fn runtime_write_text_file(path : String, content : String) -> Unit

    Write UTF-8 text file for synthetic download tests.

    set_runtime_context

    fn set_runtime_context(ctx_id : String) -> Unit

    Set current BiDi context for value serialization helpers.

    set_runtime_context_frames

    fn set_runtime_context_frames(ctx_id : String, frame_ctx_ids : Array[String]) -> Unit

    Set frame window contexts for current runtime context.

    set_runtime_context_locale

    fn set_runtime_context_locale(ctx_id : String, locale : String) -> Unit

    Set runtime navigator.language(s) for a specific context.

    set_runtime_context_network_online

    fn set_runtime_context_network_online(ctx_id : String, is_online : Bool) -> Unit

    set_runtime_context_screen_area

    fn set_runtime_context_screen_area(ctx_id : String, width : Int, height : Int, avail_width : Int, avail_height : Int) -> Unit

    set_runtime_context_screen_orientation

    fn set_runtime_context_screen_orientation(ctx_id : String, orientation_type : String, angle : Int) -> Unit

    set_runtime_context_user_agent

    fn set_runtime_context_user_agent(ctx_id : String, user_agent : String) -> Unit

    Set runtime navigator.userAgent for a specific context.

    set_runtime_context_viewport

    fn set_runtime_context_viewport(ctx_id : String, width : Int, height : Int, device_pixel_ratio : Double) -> Unit

    Set runtime viewport metrics for a specific context.

    success_bool

    fn success_bool(b : Bool) -> WebDriverResponse

    Create success response with bool value

    success_element

    fn success_element(element_id : String) -> WebDriverResponse

    Create success response with element reference

    success_null

    fn success_null() -> WebDriverResponse

    Create success response with null value

    success_object

    fn success_object(map : Map[String, WebDriverValue]) -> WebDriverResponse

    Create success response with object value

    success_string

    fn success_string(s : String) -> WebDriverResponse

    Create success response with string value

    sync_runtime_html

    fn sync_runtime_html(html : String, base_url : String, execute_scripts : Bool) -> Unit

    Synchronize HTML content into the JS runtime document.

    sync_runtime_page

    fn sync_runtime_page(url : String) -> Unit

    Synchronize runtime page by URL.

    take_channel_messages_json

    fn take_channel_messages_json() -> String

    Drain queued script channel callback payloads as JSON.

    warmup_glyph_cache

    fn warmup_glyph_cache() -> Unit

    Pre-rasterize common ASCII glyphs. Initializes providers if needed.