Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 960 Bytes

eval.md

File metadata and controls

40 lines (28 loc) · 960 Bytes
title vibium eval

Evaluate a JavaScript expression (optionally navigate to URL first).

Synopsis

vibium eval [url] [expression] [flags]

Flags

    --stdin   Read expression from stdin

Description

Executes <javascript> in the page context and prints the result to stdout. The script has full access to window, document, and any globals the page exposes.

This is the escape hatch for anything Vibium's higher-level commands don't cover — extracting computed values, dispatching custom events, querying the DOM with a custom selector, and so on. Reach for eval when the semantic commands aren't enough; reach for the semantic commands first.

Examples

vibium eval "document.title"
vibium eval "document.querySelectorAll('article').length"
vibium eval "window.scrollTo(0, document.body.scrollHeight)"

See also