Sign in

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

    ApiError

    pub(all) enum ApiError {
    ElementNotFound(selector~ : String)
    PageNotFound(page_id~ : String)
    ContextNotFound(context_id~ : String)
    Timeout(message~ : String)
    NavigationFailed(url~ : String, reason~ : String)
    ElementNotVisible(element_id~ : String)
    ElementNotEnabled(element_id~ : String)
    EvalError(message~ : String)
    InvalidArgument(message~ : String)
    NotSupported(message~ : String)
    InternalError(message~ : String)
    } derive(
    Debug
    )

    API error
    impl Show for ApiError

    ApiMethod

    pub(all) enum ApiMethod {
    NewContext
    CloseContext(context_id~ : String)
    NewPage(context_id~ : String)
    ClosePage(page_id~ : String)
    Pages(context_id~ : String)
    Goto(page_id~ : String, url~ : String)
    GoBack(page_id~ : String)
    GoForward(page_id~ : String)
    Reload(page_id~ : String)
    Url(page_id~ : String)
    Title(page_id~ : String)
    Query(page_id~ : String, selector~ : String)
    QueryAll(page_id~ : String, selector~ : String)
    WaitFor(page_id~ : String, selector~ : String, timeout~ : Int)
    BoundingBox(element_id~ : String)
    TextContent(element_id~ : String)
    InnerText(element_id~ : String)
    InnerHtml(element_id~ : String)
    GetAttribute(element_id~ : String, name~ : String)
    IsVisible(element_id~ : String)
    IsEnabled(element_id~ : String)
    IsChecked(element_id~ : String)
    Click(element_id~ : String)
    DblClick(element_id~ : String)
    RightClick(element_id~ : String)
    Hover(element_id~ : String)
    Focus(element_id~ : String)
    Fill(element_id~ : String, value~ : String)
    Press(element_id~ : String, key~ : String)
    Clear(element_id~ : String)
    SelectOption(element_id~ : String, value~ : String)
    Check(element_id~ : String)
    Uncheck(element_id~ : String)
    MouseMove(page_id~ : String, x~ : Double, y~ : Double)
    MouseClick(page_id~ : String, x~ : Double, y~ : Double, button~ : String)
    MouseDown(page_id~ : String, button~ : String)
    MouseUp(page_id~ : String, button~ : String)
    KeyboardPress(page_id~ : String, key~ : String)
    KeyboardType(page_id~ : String, text~ : String)
    Content(page_id~ : String)
    SetContent(page_id~ : String, html~ : String)
    ViewportSize(page_id~ : String)
    SetViewportSize(page_id~ : String, width~ : Int, height~ : Int)
    Evaluate(page_id~ : String, expression~ : String)
    Screenshot(page_id~ : String)
    ElementScreenshot(element_id~ : String)
    AccessibilitySnapshot(page_id~ : 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

    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

    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

    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

    Selector

    pub(all) enum Selector {
    Css(String)
    XPath(String)
    Text(String)
    TextContains(String)
    Role(role~ : String, name~ : 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

    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(session_id~ : String)
    GetSession(session_id~ : String)
    GetTimeouts(session_id~ : String)
    SetTimeouts(session_id~ : String)
    NavigateTo(session_id~ : String)
    GetCurrentUrl(session_id~ : String)
    Back(session_id~ : String)
    Forward(session_id~ : String)
    Refresh(session_id~ : String)
    GetTitle(session_id~ : String)
    GetWindowHandle(session_id~ : String)
    CloseWindow(session_id~ : String)
    SwitchToWindow(session_id~ : String)
    GetWindowHandles(session_id~ : String)
    NewWindow(session_id~ : String)
    SwitchToFrame(session_id~ : String)
    SwitchToParentFrame(session_id~ : String)
    GetWindowRect(session_id~ : String)
    SetWindowRect(session_id~ : String)
    MaximizeWindow(session_id~ : String)
    MinimizeWindow(session_id~ : String)
    FullscreenWindow(session_id~ : String)
    FindElement(session_id~ : String)
    FindElements(session_id~ : String)
    FindElementFromElement(session_id~ : String, element_id~ : String)
    FindElementsFromElement(session_id~ : String, element_id~ : String)
    GetActiveElement(session_id~ : String)
    IsElementSelected(session_id~ : String, element_id~ : String)
    GetElementAttribute(session_id~ : String, element_id~ : String, name~ : String)
    GetElementProperty(session_id~ : String, element_id~ : String, name~ : String)
    GetElementCssValue(session_id~ : String, element_id~ : String, name~ : String)
    GetElementText(session_id~ : String, element_id~ : String)
    GetElementTagName(session_id~ : String, element_id~ : String)
    GetElementRect(session_id~ : String, element_id~ : String)
    IsElementEnabled(session_id~ : String, element_id~ : String)
    ElementClick(session_id~ : String, element_id~ : String)
    ElementClear(session_id~ : String, element_id~ : String)
    ElementSendKeys(session_id~ : String, element_id~ : String)
    GetPageSource(session_id~ : String)
    ExecuteScript(session_id~ : String)
    ExecuteAsyncScript(session_id~ : String)
    GetAllCookies(session_id~ : String)
    GetNamedCookie(session_id~ : String, name~ : String)
    AddCookie(session_id~ : String)
    DeleteCookie(session_id~ : String, name~ : String)
    DeleteAllCookies(session_id~ : String)
    PerformActions(session_id~ : String)
    ReleaseActions(session_id~ : String)
    DismissAlert(session_id~ : String)
    AcceptAlert(session_id~ : String)
    GetAlertText(session_id~ : String)
    SendAlertText(session_id~ : String)
    TakeScreenshot(session_id~ : String)
    TakeElementScreenshot(session_id~ : String, element_id~ : String)
    PrintPage(session_id~ : String)
    Unknown(path~ : 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(element_id~ : 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

    error_response

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

    Create error response

    escape_json_string

    fn escape_json_string(s : String) -> String

    Escape string for JSON

    parse_request

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

    Parse HTTP request into WebDriverRequest

    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

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io