1

Im developing an script that render this page https://en.ogame.gameforge.com/.

The problem is that it is not render full content of the page. when I run my code it does not show the labels of the page, the video. it only show the background. I tried to wait 15 secounds to render and it still not working.

My code:

 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

Output:

 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
Tiago Castro
  • 421
  • 6
  • 20
  • Which PhantomJS version do you use? Please register to the `onConsoleMessage`, `onError`, `onResourceError`, `onResourceTimeout` events ([Example](https://gist.github.com/artjomb/4cf43d16ce50d8674fdf#file-1_phantomerrors-js)). Maybe there are errors. – Artjom B. Jun 30 '16 at 07:37
  • I updated the output. Im using the last version – Tiago Castro Jun 30 '16 at 07:41
  • I think we have the same Problem here. As soon as a Youtube Video is embeded into the Page we get a Javascript Error: getPresentingPlayerType@https://s.ytimg.com/yts/jsbin/player-de_DE-vflfnPyP4/base.js:7070:11. We are Using CasperJS 1.1.1 with PhantomJS 2.1.1 (Windows and Linux) – fwebdev Jul 19 '16 at 14:57
  • This is because there is no HTML5 Video or Flash support in PhantomJS. Please check this SO: http://stackoverflow.com/questions/21438826/phantom-js-error-with-youtube-video – Valera Tumash Aug 10 '16 at 01:27

0 Answers0