Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Control a headless browser console right from your terminal

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 CAKEFILE
Octocat-spinner-32 README.md
Octocat-spinner-32 phantomjs_console.coffee
README.md

PhantomJS Console

Control a headless browser console right from your terminal

Phantom Console Screencast

Dependencies

PhantomJS, the headless browser

got brew? lucky you:

$ brew update && brew install phantomjs

other systems: it's simple, too

1, 2 ... done

$ cake -l http://google.com console

Put your commands in the following file:
$EDITOR .command.js

Exit with ^ + C

 > console.log(location)
http://www.google.de/

Usage

# open command file
$ $EDITOR .command.js 

# start console
$ phantomjs phantomjs_console.coffee http://google.com

You can also use cake to open the command file and to start the console. This will let you run coffeescript commands.

$ cake -l http://google.com console

Every time you hit save in your editor, the command will be executed within the scope of the passed location (a url or a local path)

How does it work?

PhantomJS executes phantomjs_console.coffee, wich is continuously watching for changes of the .command.js file. When ever a change appears, it loads and deletes its contents and executes it as command within the scope of the passed location.

That's it. Feedback most welcome

Something went wrong with that request. Please try again.