I'm trying to load a page's full DOM using jsdom package for node.js. I have read the relevant documentation and a couple seemingly similar questions but I am still having a problem. Here's the node.js I am using:
const jsdom = require("jsdom");
const {JSDOM} = jsdom;
const virtualConsole = new jsdom.VirtualConsole();
var urlString1 = new URL(myurl);
fetch(urlString1, options1)
.then(res0 =>{console.log(res0.headers); return res0.text();})
.then(viewsource=>{
let dom = new JSDOM(viewsource, {
virtualConsole
, runScripts: "dangerously"
, resources: "usable"
, url: __dirname
});
console.log(dom.serialize());
});
I am able to see the page's full DOM in my browser Inspector, but not in View Source (since that's before the full DOM has been loaded). However, the console.log() here is only printing the View Source version, not the DOM from the Inspector.