As far as I understand, phantomjs console is asynchronous. This means that this code will show a broken output:
console.log(very_long_text);
phantom.exit(0);
Only part of the very_long_text
will be visible. The end of it will be lost, because of the asynchronous nature of console.log()
.
What is the workaround? I need to see the entire very_long_text
.
Maybe this discussion is relevant: is node.js' console.log asynchronous?
ps. This is the best I can do now, but it's extremely ugly:
console.log(very_long_text);
setTimeout(function() { phantom.exit(0); }, 100);