javascript - Creating page objects in a loop in PhantomJS -


i'm using phantomjs retrieve html of many distinct urls. this, i'm iterating on array of urls , trying create phantomjs page objects (documentation here).

for reason, console.log inside page.open block isn't firing. have idea why? can't find similar problem on google or stack overflow or phantomjs documentation.

code:

for(var = 0; < urllist.length; i++) {     urltorequest = urllist[i];     var page = require('webpage').create();     page.open(urltorequest, function (status) {         console.log("status code: ", status);         phantom.exit()     }); } 

by default console.log output page suppressed. print out define onconsolemessage handler page object done below , print.

page.onconsolemessage = function (msg, linenum, sourceid) {      console.log(msg); }; 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -