Casperjs has some issue as it's not authenticating page when loaded initially, below is my code.
var casper = require('casper').create({
verbose: false,
logLevel: 'debug',
pageSettings: {
loadImages: false, // The WebPage instance used by Casper will
loadPlugins: false, // use these settings
}
});
// print out all the messages in the headless browser context
casper.on('remote.message', function(msg) {
this.echo('remote message caught: ' + msg);
});
// print out all the messages in the headless browser context
casper.on("page.error", function(msg, trace) {
this.echo("Page Error: " + msg, "ERROR");
});
//casper.options.viewportSize = {width: 1366, height: 667};
casper.start();
casper.options.pageSettings = {
customHeaders:{
'Authorization':'Basic '+btoa('username:password')
}
}
casper.thenOpen('https://www.dmr.nd.gov/oilgas/basic/getwellprod.asp', function(status) {
if (status !== 'success') {
console.log('Unable to access network');
} else {
console.log("Getting Authenticated");
this.echo(this.getTitle());
}
});
casper.run();
I also tried using setHttpAuth with no luck. Here the Phantom version and resource.error message - Phantom version is 1.9.2 and ErrorCode is 6 and description is SSL handshake failed