I'm looking for a command line browser or web browser command-line interface (headless/gui-less option) that can be run in a terminal (preferably linux/bash) which loads the DOM and received javascript, and then allows for console execution of javascript on the loaded DOM. The goal is to operate on the DOM through the console.
I'm not looking for CLI-based page downloading, stand-alone js execution or load a js page from CLI. Links and Lynx both explicitly do not support javascript (at least according to those wikipedia pages).
Are there any command-line-based or very-very-lightweight we browsers that I could use [preferably through linux/bash (Ubuntu/Mac OS X)] to operate on the browser DOM with javascript support using an interactive console or locally-sourced javascript code?