SongGuess
    Preparing search index...

    Browser Run API binding for automating headless browsers.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Take a screenshot of a web page.

      Parameters

      • action: "screenshot"

        Must be 'screenshot'.

      • options: BrowserRunScreenshotOptions

        Screenshot options including viewport, selectors, and image format.

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • Binary image data with Content-Type: image/png, image/jpeg, or image/webp (when encoding: 'binary', the default)
      • Data URI string with Content-Type: text/plain (when encoding: 'base64')

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Generate a PDF of a web page.

      Parameters

      • action: "pdf"

        Must be 'pdf'.

      • options: BrowserRunPDFOptions

        PDF generation options including page size, margins, and headers/footers.

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • Binary PDF data with Content-Type: application/pdf

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Get the HTML content of a web page.

      Parameters

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunContentSuccessResponse JSON with Content-Type: application/json

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Scrape elements from a web page by CSS selector.

      Parameters

      • action: "scrape"

        Must be 'scrape'.

      • options: BrowserRunScrapeOptions

        Scrape options with CSS selectors for elements to extract.

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunScrapeSuccessResponse JSON with Content-Type: application/json

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Extract all links from a web page.

      Parameters

      • action: "links"

        Must be 'links'.

      • options: BrowserRunLinksOptions

        Options to filter visible or internal links only.

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunLinksSuccessResponse JSON with Content-Type: application/json

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Get both the HTML content and a base64-encoded screenshot of a web page.

      Parameters

      • action: "snapshot"

        Must be 'snapshot'.

      • options: BrowserRunSnapshotOptions

        Snapshot options including screenshot settings (encoding is always base64).

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunSnapshotSuccessResponse JSON with Content-Type: application/json

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Extract structured JSON data from a web page using AI.

      Parameters

      • action: "json"

        Must be 'json'.

      • options: BrowserRunJsonOptions

        JSON extraction options with prompt or response_format schema.

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunJsonSuccessResponse JSON with Content-Type: application/json

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
      • HTTP 422 with code 2012 for HTML-to-markdown conversion failures
      • HTTP 422/500 for AI extraction failures (may include rawAiResponse field)

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
    • Convert a web page to Markdown.

      Parameters

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunMarkdownSuccessResponse JSON with Content-Type: application/json

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
      • HTTP 422 with code 2012 for HTML-to-markdown conversion failures

      Headers:

      • X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)