• phantomjs的使用


    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();
    });
    
    网页截图
    var page = require('webpage').create(),
      system = require('system'),
      t, address;
    
    if (system.args.length === 1) {
      console.log('Usage: loadspeed.js <some URL>');
      phantom.exit();
    }
    
    t = Date.now();
    address = system.args[1];
    page.open(address, function(status) {
      if (status !== 'success') {
        console.log('FAIL to load the address');
      } else {
        t = Date.now() - t;
        console.log('Loading ' + system.args[1]);
        console.log('Loading time ' + t + ' msec');
      }
      phantom.exit();
    });
    
    phantomjs loadspeed.js http://www.google.com
    
    网站测速

    更多例子

    http://phantomjs.org/examples/index.html

  • 相关阅读:
    互联网博物馆
    CSS简介和CSS选择器
    perl 面向对象 use base
    mysql tcp 4层负载
    mysql tcp 4层负载
    mysql Emoji表情字符集转换
    mysql Emoji表情字符集转换
    html submit 登录
    html submit 登录
    haroxy hdr
  • 原文地址:https://www.cnblogs.com/norm/p/7443789.html
Copyright © 2020-2023  润新知