View stunning SlideShares in full-screen with the new iOS app!Introducing SlideShare for AndroidExplore all your favorite topics in the SlideShare appGet the SlideShare app to Save for Later — even offline
View stunning SlideShares in full-screen with the new Android app!View stunning SlideShares in full-screen with the new iOS app!
PhantomJS is a headless WebKit scriptable
Created by Ariya Hidayat. (http://ariya.ofilabs.com)
PhantomJS itself is NOT a test framework, it is
only used to launch the tests via suitable test
What Exactly Headless WebKit
WebKit is the layout engine that designed to
allow web browsers to render web pages.
Chrome, Safari and a couple of other browsers
also use WebKit.
Actually, PhantomJS is a browser but a
headless browser. This means that the
rendered web pages are never displayed.
Headless web testing. Lightning-fast testing without the
browser. Various test frameworks such as Jasmine,
Capybara, QUnit, Mocha, WebDriver, YUI Test, BusterJS,
FuncUnit, Robot Framework, and many others are
Page automation. Access and manipulate web pages with
the standard DOM API, or with usual libraries like jQuery.
Screen capture. Programmatically capture web contents,
including CSs, SVG and Canvas. Build server-side web
graphics apps, from a screenshot service to a vector chart
Network monitoring. Automate performance analysis, track
page loading and export as standard HAR format.
Multiplatform, available on major operating
systems: Windows, Mac OS X, Linux, other
Fast and native implementation of web
SVG. No emulation!
Pure headless (no X11) on Linux, ideal for
continuous integration systems. Also runs on
Amazon EC2, Heroku, Iron.io.
Easy to install.
PhantomJS needs not be used only as a stand-alone tool.
Check also some excellent related projects:
CasperJS enables easy navigation scripting and common highlevel testing.
Poltergeist allows running Capybara tests headlessly.
Guard::Jasmine automatically tests Jasmine specs on Rails
when files are modified.
GhostDriver complements Selenium tests with a PhantomJS
PhantomRobot runs Robot Framework acceptance tests in the
background via PhantomJS.
Mocha-PhantomJS run Mocha tests using PhantomJS.
How to Download and Set Up
Unzip the folder
Set the path:
1.From the Desktop, right click Computer and click Properties.
2. Click Advanced System Settings
3.Click Environment Variables... button
4.Select Path in System variables and click Edit button
5.Copy and Paste the location of phantomjs folder. Ex; in my
6. Click OK buttons.
How to Run
Create a text file that contains the following
console.log('Radiohead is Awesome, by the way Hi World!');
Save it as hi.js
Run it from command prompt like this;
The output is:
Radiohead is Awesome, by the way Hi World!
It captures screenshot with given width and
height also get the page title.
This script shows the number of twitter followers for a specific account.
For more information visit: