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

606
Views
TimeoutError: waiting for selector '--selector--' failed: timeout 30000ms exceeded

If I run code without 'waitForSelector' it gives 'null' and when I run it with 'waitForSelector' it gives time exceeded error. I already have tried giving custom value for timeout but still the problem persist.

error: Timeout or other error: TimeoutError: waiting for selector [class*="header-content"] span:nth-child(2) failed: timeout 30000ms exceeded

Output needed: '1 views'

Code:


const viewsData = async () => {   
  const browser = await puppeteer.launch()   
  const page = await browser.newPage()    
  await page.goto("https://www.loom.com/share/5b920dc1375f43fa9b622ac0a6ba7c52")   
  await page    
    .waitForSelector(`[class*="header-content"] span:nth-child(2)`)   
    .then(() => {  
      console.log("Success")   
    })   
    .catch((err) => {    
      console.log("Timeout or other error: ", err)   
    })    
  let re = await page.evaluate(() => document.querySelector(`[class*="header-content"] span:nth-child(2)`))   
  console.log(re)    
  await browser.close()   
}    
viewsData()

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