Automated screenshots in Firefox with WWW::Mechanize::Firefox

I was reading presentation slides from YAPC::EU 2010 and found this one: Web Automation with WWW::Mechanize::Firefox. It explains a module that connects to a running Firefox instance and will use it to follows links, create screenshots and more. I rewrote the example a little bit make it work. I ended up with the this. These are two methods that work. The original method didn’t work for me # The original line in the example my $png = $mech->content_as_png(); # Method 1 my $png = $mech->element_as_png($mech->selector('html')); # Method 2 my $png = $mech->content_as_png(undef, {left=>0,top=>0,width=>200, height=>200}); Now I can automatically create screenshots from webpages....

August 19, 2010