You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP_PROXY// Defines HTTP proxy settings that are used to download and run Chromium.
HTTPS_PROXY// Defines HTTP proxy settings that are used to download and run Chromium.
NO_PROXY// Defines HTTP proxy settings that are used to download and run Chromium.
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD// Do not download bundled Chromium during installation step.
PUPPETEER_DOWNLOAD_HOST// Overwrite URL prefix that is used to download Chromium. Note: this includes protocol and might even include path prefix. Defaults to https://storage.googleapis.com.
PUPPETEER_CHROMIUM_REVISION// Specify a certain version of Chromium you'd like Puppeteer to use. See puppeteer.launch([options]) on how executable path is inferred. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.
PUPPETEER_EXECUTABLE_PATH// Specify an executable path to be used in puppeteer.launch. See puppeteer.launch([options]) on how the executable path is inferred. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.
PUPPETEER_PRODUCT// Specify which browser you'd like Puppeteer to use. Must be one of chrome or firefox. Setting product programmatically in puppeteer.launch([options]) supercedes this environment variable. The product is exposed in puppeteer.product
page.on('console')// Emitted when JavaScript within the page calls one of console API methods.
page.on('dialog')// Emitted when a JavaScript dialog appears, such as alert, prompt, confirm or beforeunload.
page.on('domcontentloaded')// Emitted when the JavaScript DOMContentLoaded event is dispatched.
page.on('error')// Emitted when the page crashes.
page.on('frameattached')// Emitted when a frame is attached.
page.on('framedetached')// Emitted when a frame is detached.
page.on('framenavigated')// Emitted when a frame is navigated to a new url.
page.on('load')// Emitted when the JavaScript load event is dispatched.
page.on('metrics')// Emitted when the JavaScript code makes a call to console.timeStamp.
page.on('pageerror')// Emitted when an uncaught exception happens within the page.
page.on('popup')// Emitted when the page opens a new tab or window.
page.on('request')// Emitted when a page issues a request.
page.on('requestfailed')// Emitted when a request fails, for example by timing out.
page.on('requestfinished')// Emitted when a request finishes successfully.
page.on('response')// Emitted when a response is received.
page.on('workercreated')// Emitted when a dedicated WebWorker is spawned by the page.
page.on('workerdestroyed')// Emitted when a dedicated WebWorker is terminated.
page.accessibility// returns Accessibility
page.coverage// returns Coverage
page.keyboard// returns Keyboard
page.mouse// returns Mouse
page.touchscreen// returns Touchscreen
page.tracing// returns Tracing
page.$(selector)// The method runs document.querySelector within the page. If no element matches the selector, the return value resolves to null.
page.$$(selector)// The method runs document.querySelectorAll within the page. If no elements match the selector, the return value resolves to [].
page.$$eval(selector,pageFunction[, ...args])// This method runs Array.from(document.querySelectorAll(selector)) within the page and passes it as the first argument to pageFunction.
page.$eval(selector,pageFunction[, ...args])// This method runs document.querySelector within the page and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.
page.$x(expression)// The method evaluates the XPath expression.
page.addScriptTag(options)// Adds a <script> tag into the page with the desired url or content.
page.addStyleTag(options)// Adds a <link rel="stylesheet"> tag into the page with the desired url or a <style type="text/css"> tag with the content.
page.authenticate(credentials)// Provide credentials for HTTP authentication.
page.bringToFront()// Brings page to front (activates tab).
page.browser()// Get the browser the page belongs to.
page.browserContext()// Get the browser context that the page belongs to.
page.click(selector[,options])// This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to click in the center of the element. If there's no element matching selector, the method throws an error.
page.close([options])// Close the page
page.content()// Gets the full HTML contents of the page, including the doctype.
page.cookies([...urls])// If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned.
page.deleteCookie(...cookies)// Delete a cookie
page.emulate(options)// Emulates given device metrics and user agent.
page.emulateMediaFeatures(features)// Emulates CSS media features on the page.
page.emulateMediaType(type)// Changes the CSS media type of the page.
page.emulateTimezone(timezoneId)// Changes the timezone of the page.
page.evaluate(pageFunction[, ...args])// Evaluate the page.
page.evaluateHandle(pageFunction[, ...args])// Evaluate the page and return returns in-page object (JSHandle).
page.evaluateOnNewDocument(pageFunction[, ...args])// Adds a function which would be invoked whenever the page is navigated or whenever the child frame is attached or navigated.
page.exposeFunction(name,puppeteerFunction)// Adds a function called name on the page's window object.
page.focus(selector)// Fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error.
page.frames()// Returns an array of all frames attached to the page.
page.goBack([options])// Navigate to the previous page in history.
page.goForward([options])// Navigate to the next page in history.
page.goto(url[,options])// Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
page.hover(selector)// Fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to hover over the center of the element.
page.isClosed()// Indicates that the page has been closed.
page.mainFrame()// Returns the page's main frame.
page.metrics()// Returns an object containing the page metrics.
page.pdf([options])// Generates a pdf of the page with print css media.
page.queryObjects(prototypeHandle)// Iterates the JavaScript heap and finds all the objects with the given prototype.
page.reload([options])// Reloads the page.
page.screenshot([options])// Takes a screenshot.
page.select(selector, ...values)// Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error.
page.setCacheEnabled([enabled])// Toggles ignoring cache for each request based on the enabled state. By default, caching is enabled.
page.setContent(html[,options])// Asssigns HTML markup to the page.
page.setCookie(...cookies)// Sets a cookie.
page.setDefaultNavigationTimeout(timeout)// Changes the default maximum navigation timeout (see docs for the concerned methods).
page.setDefaultTimeout(timeout)// Changes the default maximum navigation timeout (for all methods).
page.setExtraHTTPHeaders(headers)// Sets extra HTTP headers to be sent with every request the page initiates.
page.setGeolocation(options)// Sets the page's geolocation.
page.setJavaScriptEnabled(enabled)// Whether or not to enable JavaScript on the page.
page.setOfflineMode(enabled)// When true, enables offline mode for the page.
page.setRequestInterception(value)// Whether to enable request interception.
page.setUserAgent(userAgent)// Sets the specific user agent to use in this page.
page.setViewport(viewport)// Sets the viewport.
page.tap(selector)// This method fetches an element with selector, scrolls it into view if needed, and then uses page.touchscreen to tap in the center of the element. If there's no element matching selector, the method throws an error.
page.target()// Returns a target this page was created from.
page.title()// Returns the page title.
page.type(selector,text[,options])// Sends a keydown, keypress/input, and keyup event for each character in the text.
page.url()// This is a shortcut for page.mainFrame().url()
page.viewport()// Returns the viewport information.
page.waitFor(selectorOrFunctionOrTimeout[,options[, ...args]])// Wait for the element to appear.
page.waitForFileChooser([options])// Wait for the file chooser.
page.waitForFunction(pageFunction[,options[, ...args]])// Wait for the function.
page.waitForNavigation([options])// Wait for navigation.
page.waitForRequest(urlOrPredicate[,options])// Wait for the request.
page.waitForResponse(urlOrPredicate[,options])// Wait for the response.
page.waitForSelector(selector[,options])// Wait for the selector.
page.waitForXPath(xpath[,options])// Wait for the XPath selector.
page.workers()// Returns all of the dedicated WebWorkers associated with the page.
// WORKER
// -----
// The Worker class represents a WebWorker.
// The events workercreated and workerdestroyed are emitted on the page object to signal the worker lifecycle.
accessibility.snapshot([options])// Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
// KEYBOARD
// -----
// Keyboard provides an api for managing a virtual keyboard.
frame.$(selector)// The method queries frame for the selector. If there's no such element within the frame, the method will resolve to null.
frame.$$(selector)// The method runs document.querySelectorAll within the frame. If no elements match the selector, the return value resolves to [].
frame.$$eval(selector,pageFunction[, ...args])// This method runs Array.from(document.querySelectorAll(selector)) within the frame and passes it as the first argument to pageFunction.
frame.$eval(selector,pageFunction[, ...args])// This method runs document.querySelector within the frame and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.
frame.$x(expression)// The method evaluates the XPath expression.
frame.addScriptTag(options)// Adds a <script> tag into the page with the desired url or content.
frame.addStyleTag(options)// Adds a <link rel="stylesheet"> tag into the page with the desired url or a <style type="text/css"> tag with the content.
frame.childFrames()// Returns all child frames.
frame.click(selector[,options])// This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to click in the center of the element. If there's no element matching selector, the method throws an error.
frame.content()// Gets the full HTML contents of the frame, including the doctype.
frame.evaluate(pageFunction[, ...args])// Evaluates function in the context of the frame.
frame.evaluateHandle(pageFunction[, ...args])// Evaluates function in the context of the frame and returns JSHandle.
frame.executionContext()// Returns promise that resolves to the frame's default execution context.
frame.focus(selector)// This method fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error.
frame.goto(url[,options])// Goes to url.
frame.hover(selector)// This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to hover over the center of the element. If there's no element matching selector, the method throws an error.
frame.isDetached()// Returns true if the frame has been detached, or false otherwise.
frame.name()// Returns frame's name attribute as specified in the tag.
frame.parentFrame()// Returns parent frame if any.
frame.select(selector, ...values)// Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error.
frame.setContent(html[,options])// Set content in iframe.
frame.tap(selector)// This method fetches an element with selector, scrolls it into view if needed, and then uses page.touchscreen to tap in the center of the element. If there's no element matching selector, the method throws an error.
frame.title()// Returns the page's title.
frame.type(selector,text[,options])// Sends a keydown, keypress/input, and keyup event for each character in the text.
frame.url()// Returns frame's url.
frame.waitFor(selectorOrFunctionOrTimeout[,options[, ...args]])// Wait for something.
frame.waitForFunction(pageFunction[,options[, ...args]])// Wait for function.
frame.waitForNavigation([options])// Wait for navigation.
frame.waitForSelector(selector[,options])// Wait for selector.
frame.waitForXPath(xpath[,options])// Wait for XPath selector.
// EXECUTION CONTEXT
// -----
// The class represents a context for JavaScript execution.
// Besides pages, execution contexts can be found in workers.
jsHandle.asElement()// Returns either null or the object handle itself, if the object handle is an instance of ElementHandle.
jsHandle.dispose()// Resolves when the object handle is successfully disposed.
jsHandle.evaluate(pageFunction[, ...args])// Evaluate function in the execution context the handle belongs to.
jsHandle.evaluateHandle(pageFunction[, ...args])// Evaluate function in the execution context the handle belongs to and returns JS handle.
jsHandle.executionContext()// Returns execution context the handle belongs to.
jsHandle.getProperties()// Returns a map with property names as keys and JSHandle instances for the property values.
jsHandle.getProperty(propertyName)// Fetches a single property from the referenced object.
jsHandle.jsonValue()// Returns a JSON representation of the object. If the object has a toJSON function, it will not be called.
// ELEMENTHANDLE
// -----
// ElementHandle represents an in-page DOM element.
// ElementHandles can be created with the page.$ method.
// const hrefElement = await page.$('a');
elementHandle.$(selector)// The method runs element.querySelector within the page. If no element matches the selector, the return value resolves to null.
elementHandle.$$(selector)// The method runs element.querySelectorAll within the page. If no elements match the selector, the return value resolves to [].
elementHandle.$$eval(selector,pageFunction[, ...args])// This method runs document.querySelectorAll within the element and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.
elementHandle.$eval(selector,pageFunction[, ...args])// This method runs document.querySelector within the element and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.
elementHandle.$x(expression)// The method evaluates the XPath expression relative to the elementHandle. If there are no such elements, the method will resolve to an empty array.
elementHandle.boundingBox()// Returns the bounding box of the element (relative to the main frame), or null if the element is not visible.
elementHandle.boxModel()// Returns boxes of the element, or null if the element is not visible.
elementHandle.click([options])// This method scrolls element into view if needed, and then uses page.mouse to click in the center of the element. If the element is detached from DOM, the method throws an error.
elementHandle.contentFrame()// Resolves to the content frame for element handles referencing iframe nodes, or null otherwise
elementHandle.dispose()// Stops referencing the element handle.
elementHandle.evaluate(pageFunction[, ...args])// Evaluates function in the execution content the element handle belongs to.
elementHandle.evaluateHandle(pageFunction[, ...args])// Evaluates function in the execution content the element handle belongs to and returns JS handle.
elementHandle.focus()// Calls focus on the element.
elementHandle.getProperties()// The method returns a map with property names as keys and JSHandle instances for the property values.
elementHandle.getProperty(propertyName)// Fetches a single property from the objectHandle.s
elementHandle.hover()// This method scrolls element into view if needed, and then uses page.mouse to hover over the center of the element. If the element is detached from DOM, the method throws an error.
elementHandle.isIntersectingViewport()// Resolves to true if the element is visible in the current viewport.
elementHandle.jsonValue()// Returns a JSON representation of the object.
elementHandle.press(key[,options])// Focuses the element, and then uses keyboard.down and keyboard.up.
elementHandle.screenshot([options])// This method scrolls element into view if needed, and then uses page.screenshot to take a screenshot of the element.
elementHandle.select(...values)// Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error.
elementHandle.tap()// This method scrolls element into view if needed, and then uses touchscreen.tap to tap in the center of the element. If the element is detached from DOM, the method throws an error.
elementHandle.toString()// Returns string.
elementHandle.type(text[,options])// Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.
cdpSession.detach()// Detaches the cdpSession from the target. Once detached, the cdpSession object won't emit any events and can't be used to send messages.
cdpSession.send(method[,params])// Send message.
// COVERAGE
// -----
// Coverage gathers information about parts of JavaScript and CSS that were used by the page.