Puppeteer: page.content is not a function

Created on 24 Aug 2017  路  3Comments  路  Source: puppeteer/puppeteer

It seems that while content method of Page is defined and documented, it is not exported.

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()

Most helpful comment

I met the seen problem! and it works!

All 3 comments

@selfrefactor See #483
You can install the tip-of-tree in this way:

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

It works - thanks for the quick reply!

I met the seen problem! and it works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sheweichun picture sheweichun  路  3Comments

namma-geniee picture namma-geniee  路  3Comments

aslushnikov picture aslushnikov  路  3Comments

barnash picture barnash  路  3Comments

ryanvincent29 picture ryanvincent29  路  3Comments