
PhantomJS 1.5 released (headless WebKit with JavaScript API) - andrevoget
http://code.google.com/p/phantomjs/wiki/ReleaseNotes
======
vitovito
Wow. Congrats on finally going completely headless on Linux. That's a big
deal.

This makes it the first modern browser replacement for our old moz-headless-
screenshot branch, which is effectively Firefox 3.6. It's really a shame no-
one's picked up that work for modern FF builds. Couldn't even find someone to
hire for it...

~~~
davedx
Could you explain what this means exactly, going "headless"?

~~~
gurraman
That you can operate the software without the normal i/o devices
(monitor/screen, mouse, keyboard etc).

With browsers, it's commonly used to programmatically take screenshots of web
sites.

------
DanielRibeiro
_No more support for Flash and other plugins_

So sad to hear this. That was my main motivation for using PhantomJS.
Fortunately 1.4 still supports it.

~~~
alexchamberlain
What do you use it for?

~~~
look_lookatme
I use to get a daily overview of ads on a bunch of publisher's sites,
fortunately the older version with flash support will continue to work just
fine for this case.

~~~
smilliken
We're doing this at scale at MixRank-- it'd be interesting to chat. Mind
shooting me an email? (scott at mixrank.com)

------
wildmXranat
When I use Selenium, I know the browser supports everything that the end user
will and that includes, javascript evaluation, plugin loading, whatever.

To make a comparison for our heavy Selenium use, I can't clearly see what is
lacking in PhantomJS that would be a show stopper.

Does anybody know if other than lack of Flash support, it covers all aspects
of what the end user would experience ?

~~~
lazerwalker
The main advantage of Selenium is that it allows you to test cross-platform
compatibility, since it can be configured to run on pretty much every major
browser/OS combo.

For everything other than that, though, PhantomJS is fantastic. It's
infinitely more pleasant to deal with than Selenium.

------
iamleppert
If you're looking for a great PhantomJS based testing library, check out
CasperJS. It's awesome. <http://casperjs.org/>

------
antrover
Congrats to PhantomJS!

CasperJS is built on top of PhantomJS and adds some cool assertions:
<http://casperjs.org/>

------
programminggeek
This looks incredibly useful for browser based unit testing.

~~~
ZitchDog
And screen scraping!

------
metafeather
If you are currently using Rhino to run Javascript then PhantomJS makes for an
excellent and more functional replacement.

In addition to running library unit tests in a 'real' browser environment it
can also be used to test apis and visual components, and then save results as
files and screenshots for use with other systems such as Hudson.

I use it extensively for our web app build and test cycle at work
(Causata.com) and to save time for anyone interested in rolling their own have
made the code available on Github at
<https://github.com/metafeather/phantomjs-yuitest>

------
veidr
I have been surprised that this project has seemed to fly under the radar for
so long. It's extremely useful in a variety of scenarios, and as far as I
know, it is unique in its capabilities.

I've used it to allow modern applications to interface with legacy systems
that have no mechanism of extension, and no API other than their web
interfaces. Just about anything you can control via a web interface, you (or
your software) can control using PhantomJS.

~~~
mk4p
Could you give some examples? I'm very curious about these types of uses..

~~~
andrewjshults
We're currently using it to generate static map images for a powerpoint export
feature we introduced a little while ago. We initially were going to use
Google's static maps API but quickly ran into limits (only 5 custom markers,
needing a different set of code to actually generate the maps) and decided to
take screenshots of the map in our existing application. Besides actually
being able to generate maps the way we want them, the other big advantage is
that since it's sharing the same code base as our web product it's much easier
to catch issues if they crop up. Being able to run headless on linux is
amazing (on OS X you download the binary and it just works, getting 1.4 to run
cleanly took a little bit of playing around to get Xvfb to play nice).

~~~
mk4p
Awesome; thanks for the feedback.

------
LogicX
Anyone have a cheat sheet on using phantomjs as a drop-in replacement for
wkhtmltopdf? <http://code.google.com/p/wkhtmltopdf/>

For the superior completely headless qualities? There was a post on HN almost
400 days ago where someone claimed wkhtmltopdf's PDF output quality was
superior to phantomjs - anyone know if that's changed with this release?

~~~
boundlessdreamz
It is there in the linked page

<http://code.google.com/p/phantomjs/wiki/ReleaseNotes>

Search for "rasterization"

------
hengli
I need to do some web crawling, how does this compare to jsdom on node.js? I'm
using node.js of course.

~~~
lazerwalker
In my experience, using jsdom (and other similar node.js DOM libraries) is
fine for scraping static content, but tends to fall down when you're dealing
with anything that requires executing client-side JS. That's a big deal if
you're scraping sites that load in content via XHR, or manipulate CSRF tokens
in JS specifically to throw off static scrapers. Both of these are use cases
that PhantomJS has handled beautifully for me in the past.

------
scriptproof
After having read the installation guide on Windows for Phantom.js and
WebServer, that is embedded in it, apparently installing the first to use the
second is a lot simpler!

------
maslam
So has anyone successfully deployed this on Heroku?

~~~
rgarcia
I had the same question, and it looks like you need to roll your own
buildpack. This looks promising (although it's for phantom v1.4):
[https://github.com/jessefulton/heroku-buildpack-nodejs-
phant...](https://github.com/jessefulton/heroku-buildpack-nodejs-phantomjs).

------
skeletonjelly
Awesome. Was just looking for something like this yesterday to facilitate
screenshots for an uptime script.

------
sxtxixtxcxh
we're upgrading to 1.5 now; be sure to read the build notes for linux,
specifically: "do not simply copy the executable as it won't work."

~~~
sxtxixtxcxh
also, if you had built from the source previously, be sure to do a `git clean
-xfd .` before running the ./build.sh

------
boundlessdreamz
Can phantomJS be run as a daemon?

~~~
dkhenry
I don't think it works like that. You write scripts for it and can use it to
excersize web pages. I have used it extensively to test web sites.

~~~
boundlessdreamz
Yeah. That's how I have used it. But it would be great if phantomjs can be
launched as a daemon and then you pass a script for it to process. Or launch
it with a script which runs forever and accepts input (phantomjs has an
inbuilt web server).

I think it ay be possible but wanted to know for sure.

~~~
datakurre
I've been building a wrapper to enable PhantomJS as a "remote testing library"
for RobotFramework (to do exactly what you described):
<https://github.com/datakurre/phantomrobot> (and
<http://code.google.com/p/robotframework/> for info about robot framework).

~~~
boundlessdreamz
From a cursory look, it seems you use websocket to communicate with phantom.
Neat!!

Is there a minimal program available that shows this interaction?

~~~
datakurre
Yes, it uses xmlrpc (node-xmlrpc) for communication between RobotFramework and
Node, and websockets (socket.io) for communication between Node and PhantomJS
(which didn't bundle http-server when I started).

I'm sorry to not have a separate websockets-example, but there's really
nothing special in using websockets with phantom.

