Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Examples

ariya edited this page Sep 23, 2012 · 20 revisions

PhantomJS comes with a lot of included examples. Often an example comes in two flavors: JavaScript and CoffeScript.

Basic examples

  • hello.js: Display the famous message
  • version.js: Print out PhantomJS version number
  • arguments.js: Show the arguments passed to the script
  • fibo.js: List the first few numbers in the Fibonacci sequence
  • module.js and universe.js: Demonstrate the use of module system

Rendering/rasterization

  • rasterize.js: Rasterize a web page to image or PDF
  • colorwheel.js: Create a color wheel using HTML5 canvas
  • technews.js: Capture Google News as a PNG image

Page automation

  • direction.js: Use Google Maps to print driving direction
  • ipgeocode.js: Deduce the location via IP geocoding
  • follow.js: Show the number of follower of some Twitter accounts
  • tweets.js: Display the most recent tweets

Network

  • loadspeed.js: Computes the loading speed of a web site
  • netlog.js: Dump all network requests and responses
  • netsniff.js: Capture network traffic in HAR format

(More to be written)

Clone this wiki locally