Answer the question
In order to leave comments, you need to log in
What causes FATAL error in PhantomJS?
Hey! Please help, I wrote a phantomjs script to get a screenshot of the site and the code of its page.
var page = require('webpage').create();
var system = require('system');
var fs = require('fs');
var url = system.args[1];
var width = system.args[2];
var height = system.args[3];
var outName = system.args[4];
var outNameFile = outName + ".png";
var outNameCode = outName + ".html";
page.viewportSize = { width: width, height: height };
page.clipRect = { top: 0, left: 0, width: width, height: height };
page.open(url, function() {
page.evaluate(function() {
var style = document.createElement('style'),
text = document.createTextNode('body { background: #fff }');
style.setAttribute('type', 'text/css');
style.appendChild(text);
document.head.insertBefore(style, document.head.firstChild);
});
setTimeout(function() {
page.render(outNameFile);
var content = page.content;
fs.write(outNameCode, content, 'w');
phantom.exit();
}, 2000);
});
2018-09-21T12:24:14 [FATAL] Could not initialize GLX
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
Aborted
Answer the question
In order to leave comments, you need to log in
What OS? Probably need to deliver dependencies or required libraries for GLX.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question