I am following this issue post here:
https://github.com/cyrus-and/chrome-remote-interface/issues/105
But I cannot seem to get console.log
output
For those who want a less complicated way to get data from a page I'd recommend puppeteer. It has a much clearer higher-level API than chrome-remote-interface. The best feature in my opinion is its ability to accept javascript functions instead of strings for evaluation.
Let's say we want to fetch some data from API in context of a given page.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com/');
let result = await page.evaluate(async () => {
// here comes the code which gets executed in browser
return await fetch('index.html').then(response => response.text());
});
console.log(result);
await browser.close();
})();