Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page.content is not a function #522

Closed
selfrefactor opened this issue Aug 24, 2017 · 3 comments
Closed

page.content is not a function #522

selfrefactor opened this issue Aug 24, 2017 · 3 comments

Comments

@selfrefactor
Copy link

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()
@vsemozhetbyt
Copy link
Contributor

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

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

@selfrefactor
Copy link
Author

It works - thanks for the quick reply!

@pspgbhu
Copy link

pspgbhu commented Aug 24, 2017

I met the seen problem! and it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants