Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

343
Vistas
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received Promise { <pending> }

I'm getting this error while I'm trying to scrape prnt.sc, and I don't understand why.

I think setInterval() is giving me problems.

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received Promise { }

const puppeteer = require("puppeteer");
const select = require('puppeteer-select');

async function llamar() {

  const browser = await puppeteer.launch({
    headless: true
  });

  var text = "";
  var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

  for (var i = 0; i < 6; i++)
    text += "https://prnt.sc/" + possible.charAt(Math.floor(Math.random() * possible.length));
  console.log(text)


  const page = await browser.newPage();
  path = Math.random()
  await page.goto(text)
  const element = await select(page).getElement('button:contains(AGREE)');
  await element.click()
  await page.screenshot({
    path: path + '.jpg'
  })

  await browser.close();
}

setInterval(llamar(), 2000);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Indeed, in setInterval, you are supposed to give a function, not execute one.

llamar() is executing the function.

Try this:

setInterval(llamar, 2000);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda