问题
I use phantomjs to capture a https webpage, but the resulting image is a whole black image. How do I fix it or does it mean phantomjs can't capture an https webpage?
code like this:
var webpage = require('webpage');
var page = webpage.create();
page.open('https://twitter.com/JavaScriptDaily',function(status){
page.render('twitter.jpeg', {format: 'jpeg', quality: '100'});
phantom.exit();
});
回答1:
Render your image in png, it will solve your problem.
var webpage = require('webpage');
var page = webpage.create();
page.open('https://twitter.com/JavaScriptDaily',function(status){
page.render('twitter.png', {format: 'png'});
phantom.exit();
});
来源:https://stackoverflow.com/questions/24035275/phantom-capture-https-webpage