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

97
Visualizações
Cheerio with mhtml to parse styles

So I am trying find elements on a DOM that are hidden via CSS, for example this is how I am finding them with puppeteer

let hiddenSelectors = [];
    const all = document.getElementsByTagName("*");
    let style;
    for (var i = 0, max = all.length; i < max; i++) {
      style = window.getComputedStyle(all[i]);
      if (
        style.width == "0" ||
        style.height == "0" ||
        style.opacity == "0" ||
        style.display == "none" ||
        style.visibility == "hidden"
      ) {
        hiddenSelectors.push(all[i]);
      }
    }

I want to then mark these elements with an html tag (e.g. hidden=true), however, I don't want to change the rendered dom itself... so I can't use puppeteer.

My idea was to extract a page's MHTML with all the applied css and see if I can then take this similar approach with cheerio.

Does anyone know if/how to use MHTML with cheerio to search for these types of styles?

So basically I want to use puppeteer or mhtml to find elements that css hides, then mark that selector or parent selector on the html. So when processing that html we know what is hidden upon rendering.

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