Class

Page

Page(puppeteer, tabId)

Represent a tab in the browser

Constructor

new Page(puppeteer, tabId)

Construct a Page

Parameters:
Name Type Description
puppeteer module:puppeteer/index~TBrowserPuppeteer

the browser puppeteer controlling the browser

tabId number

the tabId of the tab in the browser

View Source puppeteer/page.js, line 17

Extends

  • EventEmitter

Methods

async close() → {Promise}

Close the tab

View Source puppeteer/page.js, line 117

  • No result
Promise

async evaluate(func, …args) → {Promise}

Execute a function in the page

Parameters:
Name Type Attributes Description
func string | function
args Array.<any> <repeatable>

View Source puppeteer/page.js, line 106

  • Result of the script execution
Promise

async goto(url, eventopt) → {Promise}

The browser will visit the url {url} on tab with the id {tabId} If tabId is not defined then the tab used will be the default tab (the tab used to etablish the connection with the worker)

Parameters:
Name Type Attributes Description
url string

The url to visit

event string <optional>

When the page load should be considered finished event == "start" : before any script is loaded event == "domcontentloaded" : When DOM has finished loading event == "load" : everything has finished loading (images and scripts too)

View Source puppeteer/page.js, line 73

  • Promise resolved when the page has finished loading
Promise

mainFrame()

Return the main frame

View Source puppeteer/page.js, line 58

async screenshot(options, path, fullPage) → {Promise.<Buffer>}

Take a screenshot of the tab

Parameters:
Name Type Description
options object
path string

where the image will be save (if not null)

fullPage boolean

Capture the visible part or the fullpage ?

View Source puppeteer/page.js, line 85

  • Buffer containing the image
Promise.<Buffer>

private url()

Return the current url of the page

View Source puppeteer/page.js, line 139

async waitFor() → {Promise}

Promised resolved after ${ms} milliseconds

View Source puppeteer/page.js, line 147

Promise