Skip to main content

Installation

Requires Go 1.21+.

Quick Start

Client

NewClient(apiKey string) *Client

Creates a new API client. Pass an empty string when your self-hosted server does not enforce X-API-Key; pass your local server key if you enabled API-key authentication.

Methods

Browser Management

CreateBrowser(ctx) (*Browser, error)

Spawn a new browser instance.

GetBrowser(ctx, id) (*Browser, error)

Get the current state of a browser.

DeleteBrowser(ctx, id) error

Close a browser and release its resources.

Commands

Navigate to a URL.

Click(ctx, id, selector) error

Click an element.

NodeClick(ctx, id, node) error

Click by node reference.

Type(ctx, id, req) error

Type text into a field.

ScrollBy(ctx, id, x, y) error

Scroll by a relative amount.

ScrollTo(ctx, id, req) error

Scroll to an element or position.

Screenshot(ctx, id) (*Screenshot, error)

Capture a screenshot.

FetchHTML(ctx, id) (string, error)

Fetch the current page HTML.

FetchText(ctx, id) (string, error)

Fetch the current page text.

Eval(ctx, id, expression) (interface{}, error)

Evaluate a JavaScript expression.

Instruct(ctx, id, instruction) (*InstructResult, error)

Issue a natural language instruction.

Types

Browser

TypeRequest

ScrollToRequest

ErrorDetail