Phantomjs cannot open specific URLs

I am using the following code to take a screenshot with phantomjs. It works great for most pages, but it shows a "Operation Canceled" error for some URLs.

var page = require('webpage').create(),
system = require('system');

page.viewportSize = {
  width: 1366,
  height: 800
};

page.onConsoleMessage = function(msg) {
  console.log("CONSOLE MESSAGE:" + msg);
};

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

page.open(<URL>, function(status) {
  if (status !== 'success') {
    console.log('FAIL to load the address');
    phantom.exit();
  } else {
    page.render("3.png");

    phantom.exit();
  }
});
console.log("opening");

Some of the examples of non-performing the URL: http://india.gov.in, http://timesofindia.indiatimes.com/etc.

For the india.gov.infirst request, the URL: http://india.gov.in/ is forwarded halfway, and all existing operations will be canceled immediately before that. Similar things happen with some other URLs.

Is the page being refreshed? If so, how do I handle it?

How to do redirects / reloads in phantomjs?

. india.gov.in phantomjs ( id: 118) 37. Phantom "" . .

id 156 37 ( ). "", .

id 194 37, .

id 232 37, .

, Phantom?

Thanx!!

! ! !. phantomjs 2 . , . - , 1.9.8 2.0 ? , , 1.9.8 .

+4
2

.

https://github.com/ariya/phantomjs/issues/10522

bind(). phantomjs 1.9.7 , 2.0.

. , , pre-release 2.0 2.0 .

0

, , , .

.

- .   URL- , . , .

0

All Articles