Phantomjs stops loading full page

I am using PhantomJS 1.9.7 on Debian to parse page content. For some reason, it stops loading the page on any resource loading failure. For example, if it cannot load the .js file, it ends up with a "fail" status. So I get

FAIL to load address: xxxx caused by canceled operation


the state handler.

How can I make PhantomJS load other resources even if some of them cannot be loaded?


source to share

2 answers

It is possible that SSL is the culprit. You can try various command line options to fix the boot error, for example:



If you know a resource that isn't loading every time, you can explicitly stop loading by listening to the onResourceRequested


page.onResourceRequested = function(requestData, networkRequest){
    if (requestData.url.indexOf("yourScript.js") !== -1) {


You can also see what kind of error: onResourceError




You can find resources that are failing by typing an error on the console.

page.onResourceError = function(resourceError) {
  console.log('Unable to load resource (#' + + 'URL:' + resourceError.url + ')');
  console.log('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);


And that should print something like

Unable to load resource (#19URL:
Error code: 5. Description: Operation canceled




All Articles