redirect - PhantomJS Url fail to load for unknown reason -


here url i'm trying load phantomjs : http://shop.karinelecchi.fr/collections/jupes-robes/products/jalousie

here code :

var fs      = require("fs"); var system  = require("system");  var page = require('webpage').create(); page.settings.useragent = "mozilla/5.0 (compatible; googlebot/2.1;+http://www,google,com/bot.html)"; page.settings.loadimages = false; var url = "http://shop.karinelecchi.fr/collections/jupes-robes/products/jalousie";  page.onconsolemessage = function(msg) {  console.log(msg); }; page.open(url, function (status) { if (status !== 'success') {     console.log('unable load address!');     phantom.exit(); } else {     console.log('yiha! load address!');     phantom.exit();  } }); 

my output : "unable load address"

any guesses? thx

here have website explains how track down url load fails: https://newspaint.wordpress.com/2013/04/25/getting-to-the-bottom-of-why-a-phantomjs-page-load-fails/

just in case site goes down, i'm going copy here important details on how track down problems:

just before calling page.open() add following code:

page.onresourceerror = function(resourceerror) {     page.reason = resourceerror.errorstring;     page.reason_url = resourceerror.url; }; 

now can print out reason problem in page.open() callback, e.g.:

page.open(     "http://www.nosuchdomain/",     function (status) {         if ( status !== 'success' ) {             console.log(                 "error opening url \"" + page.reason_url                 + "\": " + page.reason             );             phantom.exit( 1 );         } else {             console.log( "successful page open!" );             phantom.exit( 0 );         }     } ); 

this script outputs following:

error opening url "http://www.nosuchdomain/": host www.nosuchdomain not found 

remember page has onerror event can more info.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -