I donβt know if this is possible or not, since I just started using and learning Perl today, but I installed the WWW::Mechanize::Firefox
module and set myself the task of installing the mozrepl
plugin in Firefox itself to find out I could do screenshots of websites.
The script works and saves screenshot screenshot png files on websites, as expected. However, if the website uses background colors and background images, they are not included in the screenshot.
Is there a way to incorporate these things or should I admit that this is exactly how it works?
For reference, this is my simple test script:
use WWW::Mechanize::Firefox; use Path::Class qw/file/; if(@ARGV == 2) { my $mech = WWW::Mechanize::Firefox->new( launch => 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe', tab => 'current', autoclose => 'close|q', mozrepl => 'mozrepl|m:s' ); $mech->get($ARGV[0]); my $fh = file($ARGV[1])->open( '> :raw' ); print $fh $mech->content_as_png(); };
source share