Linux. Installing PHANTOMJS

Source: Internet
Author: User

PHANTOMJS is a WebKit-based server-side JavaScript API. It fully supports the web without the need for browser support, its fast, native support for various web standards: DOM processing, CSS selectors, JSON, Canvas, and SVG. PHANTOMJS can be used for page automation, network monitoring, web screen screenshots, and no interface testing, etc.

1. Download the appropriate version with 64-bit Linux as an example

mkdir DOWNLOADCD downloadwget https: // bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

2. Decompression and Installation

TAR-XJVF phantomjs-2.1. 1-linux-x86_64.tar.bz2
MV Phantomjs-2.1.1-linux-x86_64/usr/local/phantomjs
Ln-s/usr/local/phantomjs/bin/phantomjs/usr/local/bin

3. Test

Phantomjs-v

Write a simple script:

var page = require ('webpage'). Create ();p age.open ('http ://www.aifei.com/', function () {  page.render ('aifei.png') );  Phantom.exit ();})

Perform a look:

Phantomjs A.js

Look at the resulting PNG image:

Look carefully, the Chinese font is garbled (or not)

Install a font dependency

Yum Install bitmap-fonts BITMAP-FONTS-CJK

Execute the script again after loading

Phantomjs A.jssz Aifei.png

It worked!

Done

Website address:

http://phantomjs.org

Linux. Installing PHANTOMJS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.