Phantomjs无法呈现整页

时间:2016-06-30 07:36:05

标签: phantomjs render

我正在开发一个呈现此页面的脚本https://en.ogame.gameforge.com/

问题是它不能呈现页面的完整内容。当我运行我的代码时,它不显示页面的标签,视频。它只显示背景。我试图等待15秒来渲染它仍然无法正常工作。

我的代码:

 var page = require('webpage').create();
page.settings.javascriptEnabled = true;
page.viewportSize = { width: 1920, height: 1080 };
page.settings.userAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64)  AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36';
page.settings.loadImages = true;//Script is much faster with this field set to false
phantom.cookiesEnabled = true;

page.open('https://en.ogame.gameforge.com/', function() {
 setTimeout(function(){
   page.render('image.jpeg', {format: 'jpeg', quality: '100'});
    phantom.exit();
}, 5000); 
});

enter image description here

输出:

 Unable to load resource (#54 URL:https://s.ytimg.com/yts/jsbin/player-en_US-vflOfyD_m/base.js)
Error code: 5. Description: Operation canceled
 ERROR: getPresentingPlayerType@https://s.ytimg.com/yts/jsbin/player-en_US-vflOfyD_m/base.js:7155:109
uA@https://s.ytimg.com/yts/jsbin/player-en_US-vflOfyD_m/base.js:2172:78
t8@https://s.ytimg.com/yts/jsbin/player-en_US-vflOfyD_m/base.js:4141:81
X8@https://s.ytimg.com/yts/jsbin/player-en_US-vflOfyD_m/base.js:4227:299
create@https://s.ytimg.com/yts/jsbin/player-en_US-vflOfyD_m/base.js:7145:552
https://s.ytimg.com/yts/jsbin/www-embed-player-vfl0QHKiK/www-embed-  player.js:484:276
[native code]
pe@https://s.ytimg.com/yts/jsbin/www-embed-player-vfl0QHKiK/www-embed-player.js:484:318
Th@https://s.ytimg.com/yts/jsbin/www-embed-player-vfl0QHKiK/www-embed-player.js:482:249
Tb@https://s.ytimg.com/yts/jsbin/www-embed-player-vfl0QHKiK/www-embed-player.js:475:189
https://s.ytimg.com/yts/jsbin/www-embed-player-vfl0QHKiK/www-embed-player.js:518:422

0 个答案:

没有答案