Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

336
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!