phantomjs实例

来源:互联网 发布:怎样从淘宝上买东西 编辑:程序博客网 时间:2024/06/07 18:43

一.脚本参数

1.argu.js

"use strict";var system = require('system');phantom.outputEncoding = "gbk";if (system.args.length === 1) {    system.args.forEach(function (arg, i) {            console.log(i + ': ' + arg);    });} else {    system.args.forEach(function (arg, i) {            console.log(i + ': ' + arg);    });}phantom.exit();


二.截图

1.screen.js

var page = require('webpage').create();page.open('http://www.baidu.com', function(){page.render('baidu.png');phantom.exit();});
2.截图位置根据控制台前面的信息




原创粉丝点击