Sign in

    mizchi/crater-browser/shell does not have a README file

    Browser

    type Browser

    Browser state

    Browser::activate_at

    async fn Browser::activate_at(self : Browser, col : Int, row : Int) -> Bool raise
    HttpError

    async fn Browser::activate_focused_link(self : Browser) -> Bool raise
    HttpError

    async fn Browser::activate_link_at(self : Browser, col : Int, row : Int) -> Bool raise
    HttpError

    Browser::cascade_reuse_last_count

    fn Browser::cascade_reuse_last_count(self : Browser) -> Int

    The number of elements that reused a prior computed style on the last render (0 when reuse was off, the stylesheet was not reuse-safe, or the CSS changed). Lets a test assert the fast path actually engaged.

    Browser::cookie_jar

    Backward-compatible accessor for the per-session cookie jar. Prefer this method over reaching into Profile internals.

    Browser::debug_layout

    fn Browser::debug_layout(self : Browser) -> Unit

    Debug: print layout tree

    Browser::enter_hint_mode

    fn Browser::enter_hint_mode(self : Browser) -> Unit

    Enter hint mode - generate hints for visible links only

    Browser::execute_inline_js_async

    async fn Browser::execute_inline_js_async(self : Browser, source : String) -> String? raise
    HttpError

    Browser::execute_scripts

    fn Browser::execute_scripts(self : Browser) -> Int

    Execute scripts from the page (inline only, sync version) Requires enable_js to be set to true (use --enable-js flag)

    Browser::exit_hint_mode

    fn Browser::exit_hint_mode(self : Browser) -> Unit

    Exit hint mode

    Browser::get_current_url

    fn Browser::get_current_url(self : Browser) -> String

    Browser::get_dom_tree

    Get current URL
    fn Browser::get_focused_link_index(self : Browser) -> Int

    Get currently focused link index
    fn Browser::get_focused_link_url(self : Browser) -> String?

    Get currently focused link URL

    Browser::get_last_navigation_url

    fn Browser::get_last_navigation_url(self : Browser) -> String?

    fn Browser::get_link_at(self : Browser, col : Int, row : Int) -> String?

    Find link URL at screen coordinates (for mouse click) Returns the resolved absolute URL if a link is found
    fn Browser::get_link_count(self : Browser) -> Int

    Get number of extracted links

    Browser::get_viewport_height

    fn Browser::get_viewport_height(self : Browser) -> Int

    Get viewport height in pixels

    Browser::go_back

    async fn Browser::go_back(self : Browser) -> String? raise
    HttpError

    Go back to previous page in history and load it

    Browser::go_forward

    async fn Browser::go_forward(self : Browser) -> String? raise
    HttpError

    Go forward to next page in history and load it

    Browser::handle_focused_key

    async fn Browser::handle_focused_key(self : Browser, key : String) -> Bool raise
    HttpError

    Browser::hover_at

    fn Browser::hover_at(self : Browser, col : Int, row : Int) -> Bool

    Browser::http_cache

    Backward-compatible accessor for the per-session HTTP cache. Prefer this method over reaching into Profile internals.

    Browser::is_hint_mode

    fn Browser::is_hint_mode(self : Browser) -> Bool

    Whether hint mode is active

    Browser::layout_box_snapshot

    fn Browser::layout_box_snapshot(self : Browser) -> String

    A deterministic geometry signature of the current render's layout boxes — id:x,y,w,h per box in document order — for VRT-style comparison of the dynamic reflow path. Forces a render so the layout tree reflects the current DOM, then flattens the absolute box geometry. Two snapshots being equal means the rendered layout is geometrically identical (the property a paint VRT checks), so an incremental re-render can be diffed against a full rebuild.

    Browser::navigate

    async fn Browser::navigate(self : Browser, url : String) -> String raise
    HttpError

    Navigate to a URL and render (adds to back history, clears forward history)

    Browser::navigate_lightweight

    async fn Browser::navigate_lightweight(self : Browser, url : String) -> String raise
    HttpError

    Navigate to URL in lightweight mode (for --json, --aom modes) Skips CSS cascade and layout calculation to reduce memory usage

    Browser::new

    fn Browser::new(width : Int, height : Int, terminal_cols? : Int) -> Browser

    Create a new browser instance
    fn Browser::next_link(self : Browser) -> Unit

    Focus next visible focusable element (Tab)

    Browser::pointer_down_at

    fn Browser::pointer_down_at(self : Browser, col : Int, row : Int) -> Bool

    Browser::pointer_move_at

    fn Browser::pointer_move_at(self : Browser, col : Int, row : Int) -> Bool

    Browser::pointer_up_at

    async fn Browser::pointer_up_at(self : Browser, col : Int, row : Int) -> Bool raise
    HttpError

    fn Browser::prev_link(self : Browser) -> Unit

    Focus previous visible focusable element (Shift+Tab)

    Browser::process_hint_char

    fn Browser::process_hint_char(self : Browser, char : String) -> String?

    Process hint character input Returns Some(url) if a hint is matched, None otherwise

    Browser::render_output

    fn Browser::render_output(self : Browser, mode : OutputMode) -> String

    Render current content in selected output mode

    Browser::render_text_full_page

    fn Browser::render_text_full_page(self : Browser) -> String

    Browser::run_event_loop

    fn Browser::run_event_loop(self : Browser, max_iterations? : Int) -> Bool

    Drive the JS event loop to quiescence: repeatedly run pending script / event tasks, drain microtasks, apply the batched DOM ops, re-render, and run one timer + requestAnimationFrame callback per iteration — looping until nothing is left to do (no pending tasks and no timer/rAF fired) or max_iterations is hit. The layout bridge is refreshed each iteration so timer / rAF callbacks measure the geometry of the latest render (setState -> re-render, effects, and animation steps run without an external pump).

    Returns true when the loop settled, false when it stopped at the iteration cap (a runaway timer chain). A navigation triggered mid-loop ends the loop and reports settled.

    Browser::scroll_down

    fn Browser::scroll_down(self : Browser, amount : Int) -> Unit

    Scroll down

    Browser::scroll_up

    fn Browser::scroll_up(self : Browser, amount : Int) -> Unit

    Scroll up

    Browser::set_cascade_reuse

    fn Browser::set_cascade_reuse(self : Browser, enabled : Bool) -> Unit

    Enable incremental (scoped) cascade — Phase 1, off by default. When on, a reflow whose stylesheet is reuse-safe (no sibling/positional/:has/:empty selectors) reuses prior computed styles for subtrees whose inputs are unchanged, skipping the O(n) re-cascade. Correctness is a pure render property, validated on the js target (incremental == full per mutation kind). See docs/incremental-cascade-design.md.

    Browser::set_dark_mode

    fn Browser::set_dark_mode(self : Browser, enabled : Bool) -> Unit

    Set dark mode explicitly

    Browser::set_enable_cookies

    fn Browser::set_enable_cookies(self : Browser, enable : Bool) -> Unit

    Enable or disable cookie jar. Swaps only the jar on the existing profile, preserving http_cache, user_agent, and auth_state.

    Browser::set_enable_js

    fn Browser::set_enable_js(self : Browser, enable : Bool) -> Unit

    Enable or disable JavaScript execution JavaScript is disabled by default for security reasons. Use --enable-js flag to enable it.

    Browser::set_html_content

    fn Browser::set_html_content(self : Browser, html : String) -> Unit

    Set HTML content directly (for testing or headless rendering).

    Browser::set_image_cache_max_bytes

    fn Browser::set_image_cache_max_bytes(self : Browser, max_bytes : Int) -> Unit

    Browser::set_incremental_reflow

    fn Browser::set_incremental_reflow(self : Browser, enabled : Bool) -> Unit

    Control incremental reflow on the dynamic-rendering path. Default on: re-renders after a DOM mutation reconcile the layout tree against the prior one (reusing cached geometry via stable uids + block-flow memoization) instead of a full from-scratch rebuild; equivalence to a full rebuild is validated on the js and native-V8 suites. Pass false to force a full rebuild every render. See docs/incremental-reflow-design.md.

    Browser::set_js_runtime

    fn Browser::set_js_runtime(self : Browser, runtime : &
    JsRuntime
    ) -> Unit

    Set a custom JS runtime for script execution (e.g. V8 for native). Must be called before any script execution (before navigate/load_html).

    Browser::set_no_color

    fn Browser::set_no_color(self : Browser, enabled : Bool) -> Unit

    Set no-color mode (disable ANSI color codes)

    Browser::set_request_sandbox

    fn Browser::set_request_sandbox(self : Browser, sandbox :
    RequestSandbox
    ) -> Unit

    Configure request sandbox policy

    Browser::tick_js

    fn Browser::tick_js(self : Browser) -> Bool

    Browser::toggle_dark_mode

    fn Browser::toggle_dark_mode(self : Browser) -> Unit

    Toggle dark mode

    Browser::toggle_selection_mode

    fn Browser::toggle_selection_mode(self : Browser) -> Bool

    Toggle selection mode (for text copy with mouse) Returns true if selection mode is now enabled, false if disabled

    Browser::write_output

    async fn[T :
    Writer
    ] Browser::write_output(self : Browser, mode : OutputMode, writer : T) -> Unit

    OutputMode

    pub(all) enum OutputMode {
    Sixel
    Kitty
    Text
    Json
    Aom
    Arc90
    ExtractMain
    Grounding
    }

    Browser output mode