#!/usr/bin/perl -w use strict; use WWW::Mechanize::PhantomJS; my $mech = WWW::Mechanize::PhantomJS->new(); $mech->get('http://google.com'); $mech->eval_in_page('alert("Hello PhantomJS")'); my $png= $mech->content_as_png();