phantom capture https webpage

大憨熊 提交于 2019-12-11 09:15:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!