Closed gealbin closed 7 years ago
You could just specify a path to the file containing your polyfill. E.g (assuming you're using the CLI):
$ pageres --script path/to/file.js example.com 1600x900
Ok, I'm using this approach, and still the same error. The script is in the same directory. any other ideas?
function getImage(call) {
const pageres = new Pageres({
delay: 15,
filename: fileName,
script: 'promise.min.js'
})
.src(url, ['1366x768'])
.dest(__dirname)
.on('warning', function(err) {
console.log('Warning: ' + err);
})
.run()
.then(function() {
console.log('End');
call();
})
Thanks for your help!
Try using script: path.join(__dirname, 'promise.min.js')
Thanks again for your help. After testing different scenarios, and your suggestions, the problem seems to be how phantomjs renders the website. BTW, is there any way to use pageres with other browser?
We will be supporting headless Chromium in the future. See https://github.com/kevva/screenshot-stream/issues/40. For now, no.
Hi,
I'm trying to get a snapshot of a webpage that contains an embedded Power BI report. The snapshot is not showing some components of the page that are shown in other browsers. After checking the warnings, I got some js errors that are not shown in Chrome, the waring are like this: Warning: ReferenceError: Can't find variable: Promise → http://[...]/powerbi.js on line 5277
It seems to be an issue with phantomjs and ES6 (which I'm not sure if it still present in recent versions of phantomjs). I also read that can it be fixed including some libraries in the code, for example promise-polyfill, but I’m not sure if that will help nor how to include that code in the 'script:' option. I’m using Nodejs v 6.10.3, phantomjs v 2.1.1 and pageres 4.5.0
Can anybody help me to fix this issue? Thanks in advance!