Light Dark

Container Requirements

Minimum Size large
Network required

Functions

build-pdf-script

fn (url: Str, output-path: Str, width: Str?, height: Str?, format: Str?, landscape: Bool, print-background: Bool, margin: Str?, wait-until: Str, delay: Int): Str

Build a one-line Node.js script that prints the page to PDF with Playwright Chromium.

build-scrape-script

fn (url: Str, wait-until: Str, delay: Int, selector: Str?): Str

Build a one-line Node.js script that prints {title, text} as JSON to stdout.

build-screenshot-script

fn (url: Str, output-path: Str, width: Int, height: Int, full-page: Bool, format: Str, quality: Int?, wait-until: Str, delay: Int): Str

Build a one-line Node.js script that captures a screenshot with Playwright Chromium.

check-box-result

fn (result: Map, tool-name: Str): Map

Fail when the box task did not complete successfully.

escape-sh-double

fn (s: Str): Str

Escape a string for safe inclusion inside double quotes in sh -c.

ns alias

Alias of ::playwright/

Playwright headless browser via Hot Box containers.

Screenshots, PDF export, and page text extraction using Chromium inside mcr.microsoft.com/playwright images. URLs are loaded with outbound internet access on the box.

Quick Start

shot ::playwright/screenshot("https://example.com")
tap(shot.url)

pdf ::playwright/pdf("https://example.com")
tap(pdf.url)

page ::playwright/scrape("https://example.com")
tap(page.title)
tap(page.text)

// With explicit output path
shot ::playwright/screenshot("https://example.com", {
    output: "hot://screenshots/example.png",
})

pdf

fn (url: Str): Map
fn (url: Str, opts: PdfOpts): Map

Render a URL to a PDF file.

Returns {url: Str} with the PDF in Hot storage.

Example

out ::playwright/pdf("https://example.com")
out ::playwright/pdf("https://example.com", {format: "Letter", landscape: true})
Container: large + network

resolve-output

fn (user-output: Str?, default: Str): Str

run-playwright-box

fn (js: Str, box-size: Str, image: Str?, sh-suffix: Str, timeout: Int): Map

Run a one-line Node script in the Playwright image with internet access, then run optional shell suffix (e.g. hotbox copy).

scrape

fn (url: Str): Map
fn (url: Str, opts: ScrapeOpts): Map

Load a URL and return visible text plus document title.

Returns {text: Str, title: Str}. With selector, text is the inner text of the first matching element.

Example

page ::playwright/scrape("https://example.com")
page ::playwright/scrape("https://example.com", {selector: "h1"})
Container: large + network

screenshot

fn (url: Str): Map
fn (url: Str, opts: ScreenshotOpts): Map

Capture a viewport or full-page screenshot of a URL.

Returns {url: Str, format: Str} with the image stored under hot://playwright/....

Example

out ::playwright/screenshot("https://example.com")
out ::playwright/screenshot("https://example.com", {
    format: "jpeg",
    quality: 85,
    full-page: true,
    wait-until: "load",
})
Container: large + network

start-pdf

fn (url: Str): Map
fn (url: Str, opts: PdfOpts): Map

Start a PDF-rendering task without awaiting the result.

Returns a TaskInfo map that can be passed to ::task/await later.

Container: large + network

start-playwright-box

fn (js: Str, box-size: Str, image: Str?, sh-suffix: Str, timeout: Int): Map

Start a one-line Node script in the Playwright image with internet access, returning TaskInfo without awaiting.

start-scrape

fn (url: Str): Map
fn (url: Str, opts: ScrapeOpts): Map

Start a scrape task without awaiting the result.

Returns a TaskInfo map that can be passed to ::task/await later.

Container: large + network

start-screenshot

fn (url: Str): Map
fn (url: Str, opts: ScreenshotOpts): Map

Start a screenshot task without awaiting the result.

Returns a TaskInfo map that can be passed to ::task/await later.

Container: large + network

Types

PdfOpts

PdfOpts type {
    width: Str?,
    height: Str?,
    format: Str?,
    landscape: Bool?,
    margin: Str?,
    print-background: Bool?,
    wait-until: Str?,
    delay: Int?,
    output: Str?,
    image: Str?,
    size: Str?,
    timeout: Int?
}

Options for pdf.

Fields

  • width — Page width (CSS string, e.g. "8.5in")
  • height — Page height (CSS string)
  • format — Paper format, e.g. "A4", "Letter" (default: "A4" when width/height unset)
  • landscape — Landscape orientation (default: false)
  • margin — Uniform margin CSS string applied to all sides (e.g. "1cm")
  • print-background — Print background graphics (default: false)
  • wait-until — Playwright goto waitUntil (default: "networkidle")
  • delay — Extra milliseconds after navigation (default: 0)
  • output — Output hot:// URL (default: auto-generated)
  • image — Override Playwright Docker image
  • size — Box size preset override (default: "medium")

ScrapeOpts

ScrapeOpts type {
    wait-until: Str?,
    delay: Int?,
    selector: Str?,
    image: Str?,
    size: Str?,
    timeout: Int?
}

Options for scrape.

Fields

  • wait-until — Playwright goto waitUntil (default: "networkidle")
  • delay — Extra milliseconds after navigation (default: 0)
  • selector — CSS selector; when set, inner text of the first match is returned instead of the body
  • image — Override Playwright Docker image
  • size — Box size preset override (default: "medium")

ScreenshotOpts

ScreenshotOpts type {
    width: Int?,
    height: Int?,
    full-page: Bool?,
    format: Str?,
    quality: Int?,
    wait-until: Str?,
    delay: Int?,
    output: Str?,
    image: Str?,
    size: Str?,
    timeout: Int?
}

Options for screenshot.

Fields

  • width — Viewport width in pixels (default: 1280)
  • height — Viewport height in pixels (default: 720)
  • full-page — Capture full scrollable page (default: false)
  • format"png" or "jpeg" (default: "png")
  • quality — JPEG quality 0–100 (JPEG only)
  • wait-until — Playwright goto waitUntil, e.g. "load", "networkidle" (default: "networkidle")
  • delay — Extra milliseconds to wait after navigation (default: 0)
  • output — Output hot:// URL (default: auto-generated)
  • image — Override Playwright Docker image
  • size — Box size preset override (default: "medium")