<commit_before>##### Released API: [v0.11.0](https://github.com/GoogleChrome/puppeteer/blob/v0.11.0/docs/api.md) | [v0.10.2](https://github.com/GoogleChrome/puppeteer/blob/v0.10.2/docs/api.md) | [v0.10.1](https://github.com/GoogleChrome/puppeteer/blob/v0.10.1/docs/api.md) | [v0.10.0](https://github.com/GoogleChrome/puppeteer/blob/v0.10.0/docs/api.md) | [v0.9.0](https://github.com/GoogleChrome/puppeteer/blob/v0.9.0/docs/api.md)

# Puppeteer API v<!-- GEN:version -->0.12.0-alpha<!-- GEN:stop-->

##### Table of Contents

<!-- toc -->

- [Puppeteer](#puppeteer)
  * [Environment Variables](#environment-variables)
  * [class: Puppeteer](#class-puppeteer)
    + [puppeteer.connect(options)](#puppeteerconnectoptions)
    + [puppeteer.executablePath()](#puppeteerexecutablepath)
    + [puppeteer.launch([options])](#puppeteerlaunchoptions)
  * [class: Browser](#class-browser)
    + [browser.close()](#browserclose)
    + [browser.newPage()](#browsernewpage)
    + [browser.version()](#browserversion)
    + [browser.wsEndpoint()](#browserwsendpoint)
  * [class: Page](#class-page)
    + [event: 'console'](#event-console)
    + [event: 'dialog'](#event-dialog)
    + [event: 'error'](#event-error)
    + [event: 'frameattached'](#event-frameattached)
    + [event: 'framedetached'](#event-framedetached)
    + [event: 'framenavigated'](#event-framenavigated)
    + [event: 'load'](#event-load)
    + [event: 'pageerror'](#event-pageerror)
    + [event: 'request'](#event-request)
    + [event: 'requestfailed'](#event-requestfailed)
    + [event: 'requestfinished'](#event-requestfinished)
    + [event: 'response'](#event-response)
    + [page.$(selector)](#pageselector)
    + [page.$$(selector)](#pageselector)
    + [page.$eval(selector, pageFunction[, ...args])](#pageevalselector-pagefunction-args)
    + [page.addScriptTag(url)](#pageaddscripttagurl)
    + [page.authenticate(credentials)](#pageauthenticatecredentials)
    + [page.click(selector[, options])](#pageclickselector-options)
    + [page.close()](#pageclose)
    + [page.content()](#pagecontent)
    + [page.cookies(...urls)](#pagecookiesurls)
    + [page.deleteCookie(...cookies)](#pagedeletecookiecookies)
    + [page.emulate(options)](#pageemulateoptions)
    + [page.emulateMedia(mediaType)](#pageemulatemediamediatype)
    + [page.evaluate(pageFunction, ...args)](#pageevaluatepagefunction-args)
    + [page.evaluateOnNewDocument(pageFunction, ...args)](#pageevaluateonnewdocumentpagefunction-args)
    + [page.exposeFunction(name, puppeteerFunction)](#pageexposefunctionname-puppeteerfunction)
    + [page.focus(selector)](#pagefocusselector)
    + [page.frames()](#pageframes)
    + [page.goBack(options)](#pagegobackoptions)
    + [page.goForward(options)](#pagegoforwardoptions)
    + [page.goto(url, options)](#pagegotourl-options)
    + [page.hover(selector)](#pagehoverselector)
    + [page.injectFile(filePath)](#pageinjectfilefilepath)
    + [page.keyboard](#pagekeyboard)
    + [page.mainFrame()](#pagemainframe)
    + [page.mouse](#pagemouse)
    + [page.pdf(options)](#pagepdfoptions)
    + [page.plainText()](#pageplaintext)
    + [page.press(key[, options])](#pagepresskey-options)
    + [page.reload(options)](#pagereloadoptions)
    + [page.screenshot([options])](#pagescreenshotoptions)
    + [page.select(selector, ...values)](#pageselectselector-values)
    + [page.setContent(html)](#pagesetcontenthtml)
    + [page.setCookie(...cookies)](#pagesetcookiecookies)
    + [page.setExtraHTTPHeaders(headers)](#pagesetextrahttpheadersheaders)
    + [page.setJavaScriptEnabled(enabled)](#pagesetjavascriptenabledenabled)
    + [page.setRequestInterceptionEnabled(value)](#pagesetrequestinterceptionenabledvalue)
    + [page.setUserAgent(userAgent)](#pagesetuseragentuseragent)
    + [page.setViewport(viewport)](#pagesetviewportviewport)
    + [page.tap(selector)](#pagetapselector)
    + [page.title()](#pagetitle)
    + [page.touchscreen](#pagetouchscreen)
    + [page.tracing](#pagetracing)
    + [page.type(text, options)](#pagetypetext-options)
    + [page.url()](#pageurl)
    + [page.viewport()](#pageviewport)
    + [page.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])](#pagewaitforselectororfunctionortimeout-options-args)
    + [page.waitForFunction(pageFunction[, options[, ...args]])](#pagewaitforfunctionpagefunction-options-args)
    + [page.waitForNavigation(options)](#pagewaitfornavigationoptions)
    + [page.waitForSelector(selector[, options])](#pagewaitforselectorselector-options)
  * [class: Keyboard](#class-keyboard)
    + [keyboard.down(key[, options])](#keyboarddownkey-options)
    + [keyboard.sendCharacter(char)](#keyboardsendcharacterchar)
    + [keyboard.up(key)](#keyboardupkey)
  * [class: Mouse](#class-mouse)
    + [mouse.click(x, y, [options])](#mouseclickx-y-options)
    + [mouse.down([options])](#mousedownoptions)
    + [mouse.move(x, y, [options])](#mousemovex-y-options)
    + [mouse.up([options])](#mouseupoptions)
  * [class: Touchscreen](#class-touchscreen)
    + [touchscreen.tap(x, y)](#touchscreentapx-y)
  * [class: Tracing](#class-tracing)
    + [tracing.start(options)](#tracingstartoptions)
    + [tracing.stop()](#tracingstop)
  * [class: Dialog](#class-dialog)
    + [dialog.accept([promptText])](#dialogacceptprompttext)
    + [dialog.defaultValue()](#dialogdefaultvalue)
    + [dialog.dismiss()](#dialogdismiss)
    + [dialog.message()](#dialogmessage)
    + [dialog.type](#dialogtype)
  * [class: Frame](#class-frame)
    + [frame.$(selector)](#frameselector)
    + [frame.$$(selector)](#frameselector)
    + [frame.$eval(selector, pageFunction[, ...args])](#frameevalselector-pagefunction-args)
    + [frame.addScriptTag(url)](#frameaddscripttagurl)
    + [frame.childFrames()](#framechildframes)
    + [frame.evaluate(pageFunction, ...args)](#frameevaluatepagefunction-args)
    + [frame.injectFile(filePath)](#frameinjectfilefilepath)
    + [frame.isDetached()](#frameisdetached)
    + [frame.name()](#framename)
    + [frame.parentFrame()](#frameparentframe)
    + [frame.title()](#frametitle)
    + [frame.url()](#frameurl)
    + [frame.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])](#framewaitforselectororfunctionortimeout-options-args)
    + [frame.waitForFunction(pageFunction[, options[, ...args]])](#framewaitforfunctionpagefunction-options-args)
    + [frame.waitForSelector(selector[, options])](#framewaitforselectorselector-options)
  * [class: ElementHandle](#class-elementhandle)
    + [elementHandle.click([options])](#elementhandleclickoptions)
    + [elementHandle.dispose()](#elementhandledispose)
    + [elementHandle.hover()](#elementhandlehover)
    + [elementHandle.tap()](#elementhandletap)
    + [elementHandle.uploadFile(...filePaths)](#elementhandleuploadfilefilepaths)
  * [class: Request](#class-request)
    + [request.abort()](#requestabort)
    + [request.continue([overrides])](#requestcontinueoverrides)
    + [request.headers](#requestheaders)
    + [request.method](#requestmethod)
    + [request.postData](#requestpostdata)
    + [request.resourceType](#requestresourcetype)
    + [request.response()](#requestresponse)
    + [request.url](#requesturl)
  * [class: Response](#class-response)
    + [response.buffer()](#responsebuffer)
    + [response.headers](#responseheaders)
    + [response.json()](#responsejson)
    + [response.ok](#responseok)
    + [response.request()](#responserequest)
    + [response.status](#responsestatus)
    + [response.text()](#responsetext)
    + [response.url](#responseurl)

<!-- tocstop -->

## Puppeteer

Puppeteer is a Node library which provides a high-level API to control Chromium over the DevTools Protocol.

### Environment Variables

Puppeteer looks for certain [environment variables](https://en.wikipedia.org/wiki/Environment_variable) to aid its operations:

- `HTTP_PROXY`, `HTTPS_PROXY`, `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_skip_chromium_download` in `.npmrc` as same)
### class: Puppeteer

Puppeteer module provides a method to launch a Chromium instance.
The following is a typical example of using a Puppeteer to drive automation:
```js
const puppeteer = require('puppeteer');

puppeteer.launch().then(async browser => {
  const page = await browser.newPage();
  await page.goto('https://www.google.com');<commit_msg>[docs] clarify env variables usage with npmrc<commit_after>##### Released API: [v0.11.0](https://github.com/GoogleChrome/puppeteer/blob/v0.11.0/docs/api.md) | [v0.10.2](https://github.com/GoogleChrome/puppeteer/blob/v0.10.2/docs/api.md) | [v0.10.1](https://github.com/GoogleChrome/puppeteer/blob/v0.10.1/docs/api.md) | [v0.10.0](https://github.com/GoogleChrome/puppeteer/blob/v0.10.0/docs/api.md) | [v0.9.0](https://github.com/GoogleChrome/puppeteer/blob/v0.9.0/docs/api.md)

# Puppeteer API v<!-- GEN:version -->0.12.0-alpha<!-- GEN:stop-->

##### Table of Contents

<!-- toc -->

- [Puppeteer](#puppeteer)
  * [Environment Variables](#environment-variables)
  * [class: Puppeteer](#class-puppeteer)
    + [puppeteer.connect(options)](#puppeteerconnectoptions)
    + [puppeteer.executablePath()](#puppeteerexecutablepath)
    + [puppeteer.launch([options])](#puppeteerlaunchoptions)
  * [class: Browser](#class-browser)
    + [browser.close()](#browserclose)
    + [browser.newPage()](#browsernewpage)
    + [browser.version()](#browserversion)
    + [browser.wsEndpoint()](#browserwsendpoint)
  * [class: Page](#class-page)
    + [event: 'console'](#event-console)
    + [event: 'dialog'](#event-dialog)
    + [event: 'error'](#event-error)
    + [event: 'frameattached'](#event-frameattached)
    + [event: 'framedetached'](#event-framedetached)
    + [event: 'framenavigated'](#event-framenavigated)
    + [event: 'load'](#event-load)
    + [event: 'pageerror'](#event-pageerror)
    + [event: 'request'](#event-request)
    + [event: 'requestfailed'](#event-requestfailed)
    + [event: 'requestfinished'](#event-requestfinished)
    + [event: 'response'](#event-response)
    + [page.$(selector)](#pageselector)
    + [page.$$(selector)](#pageselector)
    + [page.$eval(selector, pageFunction[, ...args])](#pageevalselector-pagefunction-args)
    + [page.addScriptTag(url)](#pageaddscripttagurl)
    + [page.authenticate(credentials)](#pageauthenticatecredentials)
    + [page.click(selector[, options])](#pageclickselector-options)
    + [page.close()](#pageclose)
    + [page.content()](#pagecontent)
    + [page.cookies(...urls)](#pagecookiesurls)
    + [page.deleteCookie(...cookies)](#pagedeletecookiecookies)
    + [page.emulate(options)](#pageemulateoptions)
    + [page.emulateMedia(mediaType)](#pageemulatemediamediatype)
    + [page.evaluate(pageFunction, ...args)](#pageevaluatepagefunction-args)
    + [page.evaluateOnNewDocument(pageFunction, ...args)](#pageevaluateonnewdocumentpagefunction-args)
    + [page.exposeFunction(name, puppeteerFunction)](#pageexposefunctionname-puppeteerfunction)
    + [page.focus(selector)](#pagefocusselector)
    + [page.frames()](#pageframes)
    + [page.goBack(options)](#pagegobackoptions)
    + [page.goForward(options)](#pagegoforwardoptions)
    + [page.goto(url, options)](#pagegotourl-options)
    + [page.hover(selector)](#pagehoverselector)
    + [page.injectFile(filePath)](#pageinjectfilefilepath)
    + [page.keyboard](#pagekeyboard)
    + [page.mainFrame()](#pagemainframe)
    + [page.mouse](#pagemouse)
    + [page.pdf(options)](#pagepdfoptions)
    + [page.plainText()](#pageplaintext)
    + [page.press(key[, options])](#pagepresskey-options)
    + [page.reload(options)](#pagereloadoptions)
    + [page.screenshot([options])](#pagescreenshotoptions)
    + [page.select(selector, ...values)](#pageselectselector-values)
    + [page.setContent(html)](#pagesetcontenthtml)
    + [page.setCookie(...cookies)](#pagesetcookiecookies)
    + [page.setExtraHTTPHeaders(headers)](#pagesetextrahttpheadersheaders)
    + [page.setJavaScriptEnabled(enabled)](#pagesetjavascriptenabledenabled)
    + [page.setRequestInterceptionEnabled(value)](#pagesetrequestinterceptionenabledvalue)
    + [page.setUserAgent(userAgent)](#pagesetuseragentuseragent)
    + [page.setViewport(viewport)](#pagesetviewportviewport)
    + [page.tap(selector)](#pagetapselector)
    + [page.title()](#pagetitle)
    + [page.touchscreen](#pagetouchscreen)
    + [page.tracing](#pagetracing)
    + [page.type(text, options)](#pagetypetext-options)
    + [page.url()](#pageurl)
    + [page.viewport()](#pageviewport)
    + [page.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])](#pagewaitforselectororfunctionortimeout-options-args)
    + [page.waitForFunction(pageFunction[, options[, ...args]])](#pagewaitforfunctionpagefunction-options-args)
    + [page.waitForNavigation(options)](#pagewaitfornavigationoptions)
    + [page.waitForSelector(selector[, options])](#pagewaitforselectorselector-options)
  * [class: Keyboard](#class-keyboard)
    + [keyboard.down(key[, options])](#keyboarddownkey-options)
    + [keyboard.sendCharacter(char)](#keyboardsendcharacterchar)
    + [keyboard.up(key)](#keyboardupkey)
  * [class: Mouse](#class-mouse)
    + [mouse.click(x, y, [options])](#mouseclickx-y-options)
    + [mouse.down([options])](#mousedownoptions)
    + [mouse.move(x, y, [options])](#mousemovex-y-options)
    + [mouse.up([options])](#mouseupoptions)
  * [class: Touchscreen](#class-touchscreen)
    + [touchscreen.tap(x, y)](#touchscreentapx-y)
  * [class: Tracing](#class-tracing)
    + [tracing.start(options)](#tracingstartoptions)
    + [tracing.stop()](#tracingstop)
  * [class: Dialog](#class-dialog)
    + [dialog.accept([promptText])](#dialogacceptprompttext)
    + [dialog.defaultValue()](#dialogdefaultvalue)
    + [dialog.dismiss()](#dialogdismiss)
    + [dialog.message()](#dialogmessage)
    + [dialog.type](#dialogtype)
  * [class: Frame](#class-frame)
    + [frame.$(selector)](#frameselector)
    + [frame.$$(selector)](#frameselector)
    + [frame.$eval(selector, pageFunction[, ...args])](#frameevalselector-pagefunction-args)
    + [frame.addScriptTag(url)](#frameaddscripttagurl)
    + [frame.childFrames()](#framechildframes)
    + [frame.evaluate(pageFunction, ...args)](#frameevaluatepagefunction-args)
    + [frame.injectFile(filePath)](#frameinjectfilefilepath)
    + [frame.isDetached()](#frameisdetached)
    + [frame.name()](#framename)
    + [frame.parentFrame()](#frameparentframe)
    + [frame.title()](#frametitle)
    + [frame.url()](#frameurl)
    + [frame.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])](#framewaitforselectororfunctionortimeout-options-args)
    + [frame.waitForFunction(pageFunction[, options[, ...args]])](#framewaitforfunctionpagefunction-options-args)
    + [frame.waitForSelector(selector[, options])](#framewaitforselectorselector-options)
  * [class: ElementHandle](#class-elementhandle)
    + [elementHandle.click([options])](#elementhandleclickoptions)
    + [elementHandle.dispose()](#elementhandledispose)
    + [elementHandle.hover()](#elementhandlehover)
    + [elementHandle.tap()](#elementhandletap)
    + [elementHandle.uploadFile(...filePaths)](#elementhandleuploadfilefilepaths)
  * [class: Request](#class-request)
    + [request.abort()](#requestabort)
    + [request.continue([overrides])](#requestcontinueoverrides)
    + [request.headers](#requestheaders)
    + [request.method](#requestmethod)
    + [request.postData](#requestpostdata)
    + [request.resourceType](#requestresourcetype)
    + [request.response()](#requestresponse)
    + [request.url](#requesturl)
  * [class: Response](#class-response)
    + [response.buffer()](#responsebuffer)
    + [response.headers](#responseheaders)
    + [response.json()](#responsejson)
    + [response.ok](#responseok)
    + [response.request()](#responserequest)
    + [response.status](#responsestatus)
    + [response.text()](#responsetext)
    + [response.url](#responseurl)

<!-- tocstop -->

## Puppeteer

Puppeteer is a Node library which provides a high-level API to control Chromium over the DevTools Protocol.

### Environment Variables

Puppeteer looks for certain [environment variables](https://en.wikipedia.org/wiki/Environment_variable) to aid its operations. These variables could be either set in the environment or in the [npm config](https://docs.npmjs.com/cli/config).

- `HTTP_PROXY`, `HTTPS_PROXY`, `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.

### class: Puppeteer

Puppeteer module provides a method to launch a Chromium instance.
The following is a typical example of using a Puppeteer to drive automation:
```js
const puppeteer = require('puppeteer');

puppeteer.launch().then(async browser => {
  const page = await browser.newPage();
  await page.goto('https://www.google.com');
{'fraction_non_alphanumeric': 0.18287364450730786, 'fraction_numerical': 0.0049504950495049506, 'mean_word_length': 5.516513056835637, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 15, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6218018', 'n_tokens_mistral': 5895, 'n_tokens_neox': 5431, 'n_words': 618}