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

87
Visualizações
get stuck at scrolling the page

I try to scroll the page but the scrolling gets stuck before fetching the data.

const browser = await puppeteer.launch({ headless: false });
const [page] = await browser.pages();
// test url.
await page.goto('https://www.youtube.com/channel/UCVX_4LoUm4mdZBPdpMJkkSQ/videos', 
{ waitUntil: 'networkidle2' });
await page.setViewport({
      width: 1200,
      height: 800
    });
 await page.evaluate(async () => {
    for (var y = 0; y < window.innerHeight; y += 200) {
      window.scrollTo(0, y);
    }});

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

async function autoScroll(page){
    await page.evaluate(async () => {
        await new Promise((resolve, reject) => {
            var totalHeight = 0;
            var distance = 500;
            var timer = setInterval(() => {
                var scrollHeight = document.body.scrollHeight;
                window.scrollBy(0, distance);
                totalHeight += distance;

                if(totalHeight >= scrollHeight){
                    clearInterval(timer);
                    resolve();
                }
            }, 100);
        });
    });
}

about 4 years ago · Juan Pablo Isaza Relatório
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