Page rendering and state capture for AI analysis. rendermod uses Playwright
to load a URL, collect page state (HTML, screenshot, text, links, metadata,
console output, errors, accessibility tree), and write structured outputs
for downstream tools.
- Device presets: mobile, tablet, desktop
- Config-driven renders with per-page overrides
- Form-based login automation for password-protected sites
- localStorage injection before page load
- Structured JSON summary to stdout
- Embedded, colorized help (no external docs needed)
- Python 3.8+
- Playwright
- PyYAML (for render.yaml support)
Install Playwright and Chromium:
pip install playwright
playwright install chromiumInstall PyYAML:
pip install pyyamlInitialize configuration:
python -m rendermod --initRender a page:
python -m rendermod submit
python -m rendermod submit mobile
python -m rendermod /api/status
python -m rendermod stats desktop -debug=nrendermod reads render.yaml from the current directory. If render.yaml is
missing but render.json exists, it will be auto-converted on startup.
The schema includes:
base_url: Base URL for all requestsauth: Optional form-based login (username, password, loginUrl, selectors)defaults: device, output directory, extraction typesargs: query-string args and defaultsstorage: localStorage values and defaults (optional)pages: per-page overrides (optional)
Example:
{
"base_url": "https://example.com",
"auth": {
"username": "user@example.com",
"password": "secretpassword",
"loginUrl": "https://example.com/login",
"selectors": {
"username": "#email",
"password": "#password",
"submit": "button[type=submit]"
}
},
"defaults": {
"device": "mobile",
"out_dir": "render_out",
"extract": ["metadata", "text", "links"]
},
"args": {
"values": {"debug": "y"},
"default": ["debug"]
},
"storage": {
"values": {"session": {"user": "test"}},
"default": ["session"]
},
"pages": {
"dashboard": {
"auth": {
"username": "admin@example.com"
}
},
"submit": {
"args": ["debug"]
}
}
}Each render produces three files in the configured output directory:
<page>.json: full captured state<page>.html: raw HTML<page>.png: full-page screenshot
Stdout prints a JSON summary with status, paths, stats, and metadata.
Quick help:
python -m rendermod
python -m rendermod helpDetailed help:
python -m rendermod --help
python -m rendermod --help config
python -m rendermod --help output
python -m rendermod --help args
python -m rendermod --help auth
python -m rendermod --help storage
python -m rendermod --help devices
python -m rendermod --help examplesNo build step required. Run directly from the repo:
python -m rendermod- Device presets: mobile, tablet, desktop.
- Paths starting with
/are used as-is; other paths are appended tobase_url. - If
render.yamlis missing, the CLI prompts to run--init.