Skip to content
Search

PhantomJS

lastmod 2020-11-12created 2014-09-118 edits

PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

In short, it is a module that lets you control websites using the Webkit engine(QT) without a screen.
It is usually described as Scriptable Headless WebKit; here Headless doesn't mean "without a head" but "without a screen".

How to install

$ suto apt-get install phantomjs

If Korean fonts are not installed on the system:

$ sudo apt-get install fonts-unfonts-core
$ sudo apt-get install fonts-unfonts-extra

Screenshot

// screenshot.js
var page = require('webpage').create();
page.open('http://www.daum.net', function () {
    page.render('daum.png');
    phantom.exit();
});

Then run it as follows.

phantomjs screenshot.js

See also

Favorite site

References


  1. Nodejs_and_Phantomjs_-_web_scraping.pdf ↩

author Zer0 sitemap