Having had a look at the links you've provided, I decided to give WWW::Mechanize::PhantomJS a try.
I installed the current version (0.06) on the commercial webhost that I use, using the cPanel webhosting control panel. The server is CentOS. I could not see any errors during the installation - it looked as if it installed OK. I then tried a couple of examples, including the first one at the top of the documentation page, and it fails. I then added warnings and strict, and here's the resulting code:
And here's the warning and error which result:#!/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();
Can't exec "phantomjs": No such file or directory at /home/tel2/perl5/ +lib/perl5/WWW/Mechanize/PhantomJS.pm line 101. Couldn't launch [| phantomjs /home/tel2/perl5/lib/perl5/WWW/Mechanize/ +PhantomJS/ghostdriver/main.js --PhantomJS=8910 --logLevel=OFF]: No su +ch file or directory / 0 at /home/tel2/perl5/lib/perl5/WWW/Mechanize/ +PhantomJS.pm line 101.
Here is that section of code in PhantomJS.pm:
The last line is line 101.# Launch PhantomJs $options{ launch_exe } ||= 'phantomjs'; (my $ghostdir_default= __FILE__) =~ s!\.pm$!!; $ghostdir_default= File::Spec->catfile( $ghostdir_default, 'ghostd +river', 'main.js' ); $options{ launch_ghostdir } ||= $ghostdir_default; $options{ launch_arg } ||= []; push @{ $options{ launch_arg }}, "--PhantomJS=$options{ port }"; push @{ $options{ launch_arg }}, "--logLevel=\U$options{ log }"; my $cmd= "| $options{ launch_exe } $options{ launch_ghostdir } @{ +$options{ launch_arg } }"; #warn $cmd; $options{ pid } ||= open my $fh, $cmd or die "Couldn't launch [$cmd]: $! / $?";
I've googled a bit for answers, but nothing yet. Any ideas what the problem is, or how to fix this?
Thanks again.
tel2
In reply to Re: Clicking a button with WWW::Mechanize
by tel2
in thread Clicking a button with WWW::Mechanize
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |