1

While performing screenshots of pages using PhantomJS, I noticed that it won't capture the screenshot if response status is 403 or Forbidden.

  • Test1:
var page = require('webpage').create();
page.open('http://github.com/', function() {
  page.render('test.png');
  phantom.exit();
});

phantomjs --ignore-ssl-errors=true --ssl-protocol=any --ssl-ciphers=ALL --debug=yes test.js

  • Test2:
var page = require('webpage').create();
page.open('http://cheggnet.com', function() {
  page.render('test.png');
  phantom.exit();
});
2020-01-28T22:50:02 [DEBUG] Network - Resource request error: QNetworkReply::NetworkError(ContentOperationNotPermittedError) ( "Error downloading http://cheggnet.com/ - server replied: Forbidden" ) URL: "http://cheggnet.com/"
  • which outputs the blank white background image, here I would like to take the screenshot of actual forbidden or 403 page itself instead it outputs blank white background.
Arbazz Hussain
  • 1,622
  • 2
  • 15
  • 41

0 Answers0