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

222
Visualizações
Puppeteer wait for navigation causing errors on two of the same websites

I'm having a problem with Puppeteer where I run one set of code and it works fine for a website, but then if I run the same code for another website running the same platform it doesn't work as expected. I'm using the two websites https://www.toyotaofcedarpark.com/ and https://www.toyotaofnaperville.com/ both of which are made with Dealer Inspire

This code works on https://www.toyotaofnaperville.com/ but not https://www.toyotaofcedarpark.com/ (I receive a timeout error)

index.js

var link = await scraperFunctions.getInventoryLink(page, category);
console.log("Found inventory link:", link);
await page.goto(link);
await page.waitForNavigation();
var postedVehicles = await scraperFunctions.postedVehicles(page, category);
console.log(postedVehicles, ": NUM VEHICLES");

postedVehicles.js

async function postedVehicles(page, category) {
  switch (category) {
    case 0:
      return category0(page);
    case 1:
      return category1(page);
    case 2:
      return category2(page);
  }
}
async function category0(page) {
  return await page.$eval("span#results-title", (elem) =>
    elem.innerText.replace(/\D/g, "")
  );
}
module.exports = postedVehicles;

Yet, when I remove the await page.waitForNavigation(); line from index.js it works for https://www.toyotaofcedarpark.com/ but not https://www.toyotaofnaperville.com/ (I receive a Error: Execution context was destroyed, most likely because of a navigation.

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