Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    
    ...
    
    $mech->eval_in_page('alert("Hello PhantomJS")');
    my $png= $mech->content_as_png();
    
  2. or download this
    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.
    
  3. or download this
        # Launch PhantomJs
        $options{ launch_exe } ||= 'phantomjs';
    ...
        #warn $cmd;
        $options{ pid } ||= open my $fh, $cmd
            or die "Couldn't launch [$cmd]: $! / $?";