diff --git a/docs/api.md b/docs/api.md index 798a0e0585a1f..7ed65834c88fa 100644 --- a/docs/api.md +++ b/docs/api.md @@ -887,6 +887,8 @@ During the process of closing the browser, Puppeteer attempts to delete the temp #### browser.createIncognitoBrowserContext() +- `proxyServer` <[string]> Proxy server with optional port to use for all requests. username and password can be set in ['page.authenticate']. +- `proxyBypassList` <[string]> Bypass the proxy for the given semi-colon-separated list of hosts. - returns: <[Promise]<[BrowserContext]>> Creates a new incognito browser context. This won't share cookies/cache with other browser contexts. diff --git a/src/common/Browser.ts b/src/common/Browser.ts index cbb3932d8605c..7e047fd6b6a69 100644 --- a/src/common/Browser.ts +++ b/src/common/Browser.ts @@ -293,9 +293,16 @@ export class Browser extends EventEmitter { * })(); * ``` */ - async createIncognitoBrowserContext(): Promise { + async createIncognitoBrowserContext( + server?: string, + bypassList?: string + ): Promise { const { browserContextId } = await this._connection.send( - 'Target.createBrowserContext' + 'Target.createBrowserContext', + { + proxyServer: server || undefined, + proxyBypassList: bypassList || undefined, + } ); const context = new BrowserContext( this._connection,