When I follow this tutorial (http://phantomjs.org/screen-capture.html) to do a screen capturing, I got some problem about dynamic data visualization.
In that tutorial, it uses some code like:
var page = require('webpage').create();
page.open('http://localhost:8080/index.html', function() {
page.render('screenshot.png');
phantom.exit();
});
But this seems work only with static page. I wonder if I have some some user interaction and make that page changed(like mouse click change color etc.), how can I make that capturing which show current screen?
If phantomjs can not work in this way, could anyone suggest some other solutions?
Sure, just add the functionality you want after
page.open()
and beforepage.render()
.Keep in mind that you are working with Javascript here and that you can inject arbitrary helper scripts, like CasperJS or jQuery, and use their functionality on the loaded page.
For inspiration: