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

167
Vistas
page.evaluate() - document is not defined

I tried to get the Document of a Website with Puppetter but somehow page.evaluate doesnt work the way i thought.

  let browser = await puppeteer.launch({headless:true});
  let page = await browser.newPage();
  await page.setViewport({
    width: 1920,
    height: 1080
  })
  await page.goto('https://www.tradingview.com/chart/');

  const doc = await page.evaluate(() => {
    return document;
  });
  
  console.log(doc) 

When i print doc it prints undefined

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

0

Unfortunately, page.evaluate() can only transfer serializable values (roughly, the values JSON can handle). As document returns a DOM element that is not serializable (it contains methods and circular references), it is replaced with undefined. You need to return either serializable value (for example, document.body.innerText) or use something like page.evaluateHandle() and JSHandle API.

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