in reply to Download FIle with WWW::Mechanize::PhantomJS

Does the content method work? What does phantomjs.org say about how it handles file downloads?
  • Comment on Re: Download FIle with WWW::Mechanize::PhantomJS

Replies are listed 'Best First'.
Re^2: Download FIle with WWW::Mechanize::PhantomJS
by NeerajPandey (Novice) on Dec 24, 2015 at 13:32 UTC
    'content' is providing source of the page. i used as print $mech->content(); And about handling download I read some articles that show its possible with phantomjs but examples are given in .js. The documentation of WWW::Mechanize::PhantomJS does not state any particular method of handling file downloads.

      phantomjs but examples are given in .js

      Great, where is that?

        var fs = require('fs'); var page=this; var result = page.evaluate(function() { var out; $.ajax({ 'async' : false, 'url' : 'fullurltodownload.csv', 'success' : function(data, status, xhr) { out = data; } }); return out; }); fs.write('mydownloadedfile.csv', result);
        Found something here http://stackoverflow.com/questions/31564215/how-to-download-a-csv-file-using-phantomjs.