Puppeteer: page.content no es una función

Creado en 24 ago. 2017  ·  3Comentarios  ·  Fuente: puppeteer/puppeteer

Parece que si bien el método content de Page está definido y documentado, no se exporta.

const puppeteer = require("puppeteer")

const resolution = {
  x : 1920,
  y : 1080,
}

const args = [
  "--no-first-run",
  "--disable-sync",
  "--disable-gpu",
  "--disable-translate",
  "--disable-background-networking",
  "--single-process",
  `--window-size=${ resolution.x },${ resolution.y }`,
  '--no-sandbox',
  '--disable-setuid-sandbox',
  '--shm-size=1G'
]

const fn = async () => {
  try {
    const browser = await puppeteer.launch({
      headless     : true,
      handleSIGINT : false,
      args         : args,
    })
    const page = await browser.newPage()
    page.on("console", (...args) => {
      for (let i = 0; i < args.length; ++i) { console.log(`${ i }: ${ args[ i ] }`) }
    })

    await page.setViewport({width: resolution.x, height: resolution.y})
    await page.goto('https://ilearnsmarter.com/', {
      waitUntil          : "networkidle"
    })

    console.log(await page.content())

    await page.close()

    browser.close()

  } catch (err) {
    console.log(err)
  }
}

fn()

Comentario más útil

¡Conocí el problema visto! ¡y funciona!

Todos 3 comentarios

@selfrefactor Ver #483
Puede instalar la punta del árbol de esta manera:

npm install https://github.com/GoogleChrome/puppeteer/

Funciona - ¡gracias por la rápida respuesta!

¡Conocí el problema visto! ¡y funciona!

¿Fue útil esta página
0 / 5 - 0 calificaciones

Temas relacionados

MehdiRaash picture MehdiRaash  ·  3Comentarios

ngryman picture ngryman  ·  3Comentarios

ryanvincent29 picture ryanvincent29  ·  3Comentarios

td0m picture td0m  ·  3Comentarios

namma-geniee picture namma-geniee  ·  3Comentarios