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

158
Vistas
Puppeteer page's content when I pass it to another function vanishes

I'm using Puppeteer to web scrap my website. I'm using await page.content() and console logging it and I'm getting the content in the logs but when I pass page as an argument to another javascript function. The await page.content() is null. Nothing is present in the content even though I can still see the content in the browser. I have no idea why this is happening, I did literally the same things for other url of the same website but they are working fine. Only in this case, the await page.content() is returning null. I know that I can pass await page.content() as an argument directly but that won't suffice because I have conditions when to call this, otherwise server load would be high.

func1(){
   let a = await page.content()
   console.log(a) // works fine and prints the html
}

func2(){
 func3(page);
}

func3(page){
 let c = await page.content()
 console.log(c);
 //Prints nothing
}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Before func3 add the keyword async. Later, write:

await func3(page)
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