How can I console.log something inside the page.evaluate, passing it to node and using it during the evaluation of the page?
I actually want to log
I like @Vaviloff's answer, but you will log the whole ConsoleMessage object when you may just want the text. Thus, I personally use the below:
const EOL = require('os').EOL;
const _page = await browser.newPage();
_page.on('console', _fCleanLog);
function _fCleanLog(ConsoleMessage) {
console.log(ConsoleMessage.text + EOL);
}