SongGuess
    Preparing search index...

    Class BrowserRunAbstract

    Browser Run API binding for automating headless browsers.

    Index
    • get devtools(): BrowserRunDevtools

      DevTools JSON methods exposed through one nested binding target.

      Returns BrowserRunDevtools

    • Return details for one browser session, or null when it does not exist.

      Parameters

      • sessionId: string

      Returns Promise<BrowserRunSession | null>

    • Return the caller's browser-session and browser-time limits.

      Returns Promise<BrowserRunLimits>

    • 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 several representations of a web page in one request.

      Parameters

      • action: "snapshot"

        Must be 'snapshot'.

      • options: BrowserRunSnapshotOptions

        Snapshot options including the formats to return and 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)
    • Get the accessibility tree of a web page.

      Parameters

      • action: "accessibilityTree"

        Must be 'accessibilityTree'.

      • options: BrowserRunAccessibilityTreeOptions

        Options to scope the tree to a subtree and to control whether semantically uninteresting nodes are pruned.

      Returns Promise<Response>

      A Response containing one of:

      Success (HTTP 200):

      • BrowserRunAccessibilityTreeSuccessResponse JSON with Content-Type: application/json
      • result.accessibilityTree is null when root matched no element

      Error:

      • BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
      • HTTP 422 for a malformed root selector
      • HTTP 500 with code 2017 or 2018 when the tree could not be built

      Headers:

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