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

131
Vistas
Cannot select element using Puppeteer

I'm using puppeteer to scrape some data off of a website, but all of my selections for a certain element are always undefined.

    const tempFunction = await page.evaluate(() => {
        let a = document.querySelectorAll(".flex.flex-wrap.w-100.flex-grow-0.flex-shrink-0.ph2.pr0-xl.pl4-xl.mt0-xl.mt3")
        let container = document.querySelector(".flex.flex-wrap.w-100.flex-grow-0.flex-shrink-0.ph2.pr0-xl.pl4-xl.mt0-xl.mt3")
        let b = container.getElementsByClassName("mb1 ph1 pa0-xl bb b--near-white w-33")
        return b
    })

For some reason this code always returns undefined, but similar code works fine.

    const checkData = await page.evaluate(() =>{
        let tempArray = []
        let element = document.querySelectorAll('.weather-block')
        
        tempArray.push(element[0].innerText)  
        return tempArray
    })

Even when trying to use specific selectors or id's, I only get undefined. Not sure where to go from here.

about 4 years ago · Santiago Gelvez
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