Documentation
Automation Layer

Chrome Automation

Instrument headless Chromium instances natively from the server virtual machine. Generate screenshots, capture page states, and generate PDF invoices dynamically.

01

Headless Web Capture

Deploy the chromedp module to spin up isolated browser contexts, navigate to targets, and capture page buffers.

capture.js
import { chromedp } from 'kitwork';

const pngBytes = chromedp.capture("https://github.com", {
    width: 1280,
    height: 720
});
02

Serving Screenshot Streams

Deliver binary PNG buffers straight back to the client request stream by using the response image handler.

server-capture.js
router.get("/screenshot").handle((req, res) => {
    const targetUrl = req.query("url").text() || "https://github.com";
    const pngBytes = chromedp.capture(targetUrl, {
        width: 1280,
        height: 720
    });
    return res.image(pngBytes);
});
03

Advanced Options & Wait Policies

Control the browser life cycle. Customize selector loading rules and wait delays to ensure asynchronous client-side SPAs render fully before screenshot acquisition.

wait-policies.js
const pngBytes = chromedp.capture("https://github.com", {
    width: 1920,
    height: 1080,
    waitSelector: ".dashboard-grid",  // Wait until element loads
    timeout: "5s"                          // Timeout ceiling limit
});