Coder Social home page Coder Social logo

page-monitor's Introduction

Page Monitor

capture webpage and diff the dom change with phantomjs

Effects

Element Add

element add

Element Removed

element removed

Text Changed

element removed

Style Changed

element removed

Make UI to show diffs of history

https://github.com/fouber/pmui

ui

Usage

First of all, install phantomjs, page-monitor relys on phantomjs to render webpage and genenrate screenshot. DO NOT use npm to install phantomjs on winidows, it can't be launched by spawn.

var Monitor = require('page-monitor');

var url = 'http://www.google.com';
var monitor = new Monitor(url);
monitor.capture(function(code){
    console.log(monitor.log); // from phantom
    console.log('done, exit [' + code + ']');
});

API

Monitor

var monitor = new Monitor(url [, options]);

see the default options here: https://github.com/fouber/page-monitor/blob/master/index.js , you can override any option for your monitoring.

monitor.capture(callback [, noDiff]);

caputure webpage and save screenshot, then diff with last save.

var monitor = new Monitor(url, options);
monitor.on('debug', function (data) {
    console.log('[DEBUG] ' + data);
});
monitor.on('error', function (data) {
    console.error('[ERROR] ' + data);
});
monitor.capture(function(code){
    console.log(monitor.log.info); // diff result
    console.log('[DONE] exit [' + code + ']');
});

monitor.diff(left, right, callback);

diff change between left(date.getTime()) and right(date.getTime()).

var monitor = new Monitor(url, options);
monitor.on('debug', function (data) {
    console.log('[DEBUG] ' + data);
});
monitor.on('error', function (data) {
    console.error('[ERROR] ' + data);
});
monitor.diff(1408947323420, 1408947556898, function(code){
    console.log(monitor.log.info); // diff result
    console.log('[DONE] exit [' + code + ']');
});

events

var monitor = new Monitor(url);
monitor.on('debug', function (data) {
    console.log('[DEBUG] ' + data);
});
monitor.on('error', function (data) {
    console.error('[ERROR] ' + data);
});
  • debug: debug from phantom
  • notice: console from webpage
  • info: info from phantom
  • warning: error from webpage
  • error: error from phantom

page-monitor's People

Contributors

chrisabrams avatar fouber avatar robhammond avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.