Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda