Skip to content

ainkov/flaming-octo-puss

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visual debugging for PhantomJS / CasperJS

This little hack is using a simple technique: It grabs the screen as PhantomJS or CasperJS sees it with captureBase64('png') and then it is POSTing the image into the receiving server which then sends it via socket.io to the browser which displays it is as inline image.

Here is how it works:

Setup

  1. Grab the repo (and node.js if you don't have it)
  2. run npm install
  3. run node server.js
  4. go to http://localhost:8001
  5. use the code below in your phantom or casper script to update the image:
this.evaluate( function(img){
  __utils__.sendAJAX("http://localhost:8001/", 'POST', {'img' : img }, false);    
  }, 
  {'img' : this.captureBase64('png')} 
);

OR you can attach it to onStepComplete handler

OR use setInterval to get a fresh screenshot every x ms - I'd recommend 150-300ms.

p.s. Remember to set the viewport size otherwise you can get the responsive, squeezed page.

About

Visual debugging for PhantomJS / CasperJS - allows you to see what the browser is rendering

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published