Installation procedure and Usage method of PHANTOMJS Linux system

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.

I use the screen screenshot function, the following is the process of my operation and the installation of the screen function test.

First step: Phantomjs installation
Debian and Ubunto installation commands
  sudo apt-get install build-essential g++ Flex Bison gperf Ruby perl \
  Libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev \
  libpng -dev libjpeg-dev python libx11-dev libxext-dev

CentOS Install command
  sudo yum-y install gcc gcc-c++ make Flex bison Gperf ruby \
  openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel \
  Libpng-devel Libjpeg-devel

Second Step: Phantomjs compilation

git clone git://github.com/ariya/phantomjs.git
CD PHANTOMJS
git Checkout 2.0
./BUILD.SH (compilation is slow and requires patience)


Part III: Establishing a/usr/local/bin/soft connection ( This executes the command without the path of the command)
ln-s/root/phantomjs/bin/phantomjs/usr/local/bin/phantomjs


Fourth: Test the screenshot function (called JS file directory can set a path constant in the project)
phantomjs /root/phantomjs/examples/rasterize.js/http Www.aitifen.com/upload/report/119.html/data/wwwroot/login2.png

Well, login2.png is the picture I want to get from the screenshot.

Installation procedure and Usage method of PHANTOMJS Linux system

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.