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

164
Visualizações
Fetch other web page and get async content

In my Greasemonkey script I'm fetching some other web page and using the response in my code. However when I do this, it only gets the initial HTML content. If some of the content is async (which loads later) then I can't see that content in the response.

My researchs told me to use "waitForKeyElements", but it only work if the current url = the fetching page. It doesn't work when I fetch data from another web page.

If there is something I can do for my needs (not necessarily DOMParser), please tell me.

Here is my code:

// this script runs when I'm in google.com

GM_xmlhttpRequest({
    url : "https://www.example.com",
    method : "GET",
    timeout: 10000,
    onload : function(response) {
        if (response.status == 200) {

            const parser = new DOMParser();
            const result = parser.parseFromString(response.responseText, "text/html").body; 
 
            let div = result.querySelector(".some-selector-here") 
            // returns null because this is async content


        } else {
            console.log(" Error: HTTP " +response.status+ " Error.");
        }
    },

});
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