首页 > 技术文章 > PhantomJs 笔记

au_ww 2017-08-02 15:03 原文

2017-08-02 初识 PhantomJs

docs link http://phantomjs.org/quick-start.html

 

PhantomJs 异常强大,可以用来截图、测试、抓网页等等等等等。

 

网页截图,eg:

capture.js

var page = require('webpage').create();
page.open('http://example.com', function(status) {
  console.log("Status: " + status);
  if(status === "success") {
    page.render('example.png');
  }
  phantom.exit();
});

run command:  phantomjs capture.js 

 

 

 

page 对象上的属性: http://phantomjs.org/page-automation.html

 

phantomjs 命令行参数列表:http://phantomjs.org/api/command-line.html

 

推荐阅读