PhantomJS - GhostDriver - get an array from executePhantomJS

106 views
Skip to first unread message

Felix Neutatz

unread,
Dec 16, 2014, 1:34:31 PM12/16/14
to phan...@googlegroups.com
Hi,

I have also another question. I think this is rather an easy to answer question. I want get all urls of all requested resources. At the moment I write them all in a file:

Object result = phantom.executePhantomJS(
               
"var page          = this;\n" +

               
"var filename = '" + tempLog.getAbsolutePath() + "';\n" +
               
"var fs = require('fs');\n" +

               
"page.onResourceRequested = function (requestData, networkRequest) {\n" +
               
"      var content = fs.read(filename);\n" +
               
"      fs.write(filename, content + '>' + requestData.url + ' ', 'w');\n" +
               
"};\n");

How is it possible, to pass the same data to the result object?

Thank you for your help,

Felix


P.S.:
$ phantomjs --version
1.9.8
Linux Tardis 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Reply all
Reply to author
Forward
0 new messages