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 |
Extends
- EventEmitter
Methods
async evaluate(func, …args) → {Promise}
Execute a function in the page
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
func |
string | function | ||
args |
Array.<any> |
<repeatable> |
- 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) |
- Promise resolved when the page has finished loading
Promise
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 ? |
- Buffer containing the image
Promise.<Buffer>
async waitFor() → {Promise}
Promised resolved after ${ms} milliseconds
Promise