PhantomJS an Amazing Headless WebKit Scriptable with a JavaScript API

PhantomJS an Amazing Headless WebKit Scriptable with a JavaScript API

When I first read about PhantomJS, just became astonished to see how many reach features it has and how easy these are for the implementation! Really it is handy for developers and testers. And it is so easy to learn. I’m not going to discuss any details about it. Their documentation and getting started guide are well written and provide lots of real life examples. So if you are interested to learn it then you can visit this page.

An useful example and usage of PhantomJS is to capture web page screen in different output formats without involving any installed browser. You need very few lines of code to achieve this. You can capture the whole screen at a time in different formats. Here is the sample code (taken from here) to capture web screen:

var page = require(‘webpage’).create();

page.open(‘http://github.com’ , function () {

page.render(‘github.png’);

phantom.exit();

});

Recently I’ve created a windows application called CaptureWebPage. I’ve used the phantomjs.exe and .NET/C# to build that application. Here is the screen of the app:

Screen of CaptureWebPage

Screen of CaptureWebPage

If you have already visited this page or downloaded my application CaptureWebPage from codeproject then I’m sure you are also amazed with the features of PhantomJS, isn’t it? I will be really grateful to you if also please share your experience about PhantomJS.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s