40
17
Does anybody know good command line browser with js support?
Ideally I need following ability:
some-browser http://example.com > ~/page.html
It means that cli browser download html, execute js and output a page.
40
17
Does anybody know good command line browser with js support?
Ideally I need following ability:
some-browser http://example.com > ~/page.html
It means that cli browser download html, execute js and output a page.
37
I'm not aware of an interactive browser with js support but you should have a look at PhantomJS which is defined as:
PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
To get the page's content after it's been rendered:
$ phantomjs save_page.js http://example.com > ~/page.html
with save_page.js:
var system = require('system');
var page = require('webpage').create();
page.open(system.args[1], function()
{
console.log(page.content);
phantom.exit();
});
An interesting side-project is phantomjs-node which integrates PhantomJS with NodeJS, allowing the former to be used as a NodeJS module.
Spot on. Just what I was looking for. I didn't need to ask my question in the end – Sevenearths – 2015-01-09T09:19:43.010
2I just tried this on a page I created myself. It is dumping the page before the javascript runs. Any suggestions? – abalter – 2017-10-30T04:11:03.213
@abalter: That obviously means there is a syntax error in your page. – Julie Pelletier – 2018-01-22T17:22:38.403
5
Edbrowse, an ed-style editor/browser optimized for blind users but appreciated by sysadmins for its scriptability, claims to support javascript based on Mozilla's engine. It's at http://the-brannons.com/edbrowse/.
4
According to the documentation for elinks
, it supports JavaScript. See section 2.6.1 for information on installing SpiderMonkey.
1It depends on how you compile the links (or elinks) – kokosing – 2017-03-09T11:04:04.170
4
If you are running linux, you can remote control Firefox using Ruby (and presumably other language bindings) with watir-webdriver, then after you have it working you can trick it into running without any display (but still hit the page, uploading downloading or scraping data) using Xvfb,
2
In case a PNG of the webpage is enough and you don't need the HTML source, you should be able to use webkit-image
, a small command line utility that comes with Ubuntu. It's however not exactly a feature rich application, so it doesn't offer much customization, it might however be a good starting point for further hacking and thus maybe even allow getting the processed HTML output relatively easily.
See also: Text based webbrowser that supports JavaScript?
– unor – 2016-07-28T14:31:28.9071
I haven't really played with it but maybe uzbl (http://uzbl.org/) could do it.
– LawrenceC – 2012-07-14T01:02:05.767