How to use 'takeShotOnCallback' exactly in NODE app
I am using high chart in my html page. I want to take screen shot once chart fully loaded. For now i have used 'renderDelay' option. but i want to use takeShotOnCallback for consistancy.
Can anyone help me out how to use takeShotOnCallback exactly. I am not able to find example in doc too.
I am using below options for now.
var options = { width: 'all', height: 'all', renderDelay: 5000 };
Thanks, Hemang
try the options:
{
...
takeShotOnCallback: true,
// Phantom callbacks
onLoadFinished: function () {
window.callPhantom('takeShot');
},
},
You may add the takeShotOnCallback to options in such way
var options = {
width: 'all',
height: 'all',
renderDelay: 5000,
takeShotOnCallback: true
}
In the page that you taking snapshot, you may manually trigger window.callPhantom('takeShot').
So PhantomJS would take a snapshot after renderDelay once it is triggered.
I believe that PhantomJS will inject function as callPhantom function is not default window function. You can use try:catch to handle exception if user views page directly and only trigger it successfully when PhantomJS views the page