satyashani has asked for the wisdom of the Perl Monks concerning the following question:
Is there an existing way to do it or will I have to dig deeper in code.use WWW::Mechanize::Firefox; use File::Spec; my $mech = WWW::Mechanize::Firefox->new( bufsize => 10_000_000, # PNGs might become huge autoclose => false ); $mech->get('http://layout.jquery-dev.net/demos/simple.html'); my $png = $mech->content_as_png(); my @links = $mech->by_id('center'); my $png2 = $mech->element_as_png(@links); open my $fh, '>', 'page.png' or die "Couldn't save to 'page.png': $!"; binmode $fh; print {$fh} $png; close $fh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: page screenshot using www::mechanize::firefox
by Corion (Patriarch) on Mar 02, 2012 at 15:54 UTC | |
by satyashani (Initiate) on Mar 02, 2012 at 17:27 UTC | |
|
Re: page screenshot using www::mechanize::firefox
by moritz (Cardinal) on Mar 02, 2012 at 15:05 UTC | |
by satyashani (Initiate) on Mar 02, 2012 at 18:42 UTC | |
|
Re: page screenshot using www::mechanize::firefox
by Anonymous Monk on Mar 02, 2012 at 14:51 UTC | |
by satyashani (Initiate) on Mar 02, 2012 at 15:19 UTC |