Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
JSDOM.serialize() showing initial View Source, not full DOM (node.js)

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!