PhantomJs 笔记

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

 

posted @ 2017-08-02 15:03  Au_ww  阅读(99)  评论(0编辑  收藏  举报