diff --git a/docs/api.md b/docs/api.md index ceffda08236..4eee3fb791e 100644 --- a/docs/api.md +++ b/docs/api.md @@ -97,35 +97,35 @@ * [page.bringToFront()](#pagebringtofront) * [page.browser()](#pagebrowser) * [page.click(selector[, options])](#pageclickselector-options) - * [page.close(options)](#pagecloseoptions) + * [page.close([options])](#pagecloseoptions) * [page.content()](#pagecontent) - * [page.cookies(...urls)](#pagecookiesurls) + * [page.cookies([...urls])](#pagecookiesurls) * [page.coverage](#pagecoverage) * [page.deleteCookie(...cookies)](#pagedeletecookiecookies) * [page.emulate(options)](#pageemulateoptions) * [page.emulateMedia(mediaType)](#pageemulatemediamediatype) - * [page.evaluate(pageFunction, ...args)](#pageevaluatepagefunction-args) - * [page.evaluateHandle(pageFunction, ...args)](#pageevaluatehandlepagefunction-args) - * [page.evaluateOnNewDocument(pageFunction, ...args)](#pageevaluateonnewdocumentpagefunction-args) + * [page.evaluate(pageFunction[, ...args])](#pageevaluatepagefunction-args) + * [page.evaluateHandle(pageFunction[, ...args])](#pageevaluatehandlepagefunction-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.goBack([options])](#pagegobackoptions) + * [page.goForward([options])](#pagegoforwardoptions) + * [page.goto(url[, options])](#pagegotourl-options) * [page.hover(selector)](#pagehoverselector) * [page.isClosed()](#pageisclosed) * [page.keyboard](#pagekeyboard) * [page.mainFrame()](#pagemainframe) * [page.metrics()](#pagemetrics) * [page.mouse](#pagemouse) - * [page.pdf(options)](#pagepdfoptions) + * [page.pdf([options])](#pagepdfoptions) * [page.queryObjects(prototypeHandle)](#pagequeryobjectsprototypehandle) - * [page.reload(options)](#pagereloadoptions) + * [page.reload([options])](#pagereloadoptions) * [page.screenshot([options])](#pagescreenshotoptions) * [page.select(selector, ...values)](#pageselectselector-values) * [page.setBypassCSP(enabled)](#pagesetbypasscspenabled) - * [page.setCacheEnabled(enabled)](#pagesetcacheenabledenabled) + * [page.setCacheEnabled([enabled])](#pagesetcacheenabledenabled) * [page.setContent(html)](#pagesetcontenthtml) * [page.setCookie(...cookies)](#pagesetcookiecookies) * [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) @@ -146,15 +146,15 @@ * [page.viewport()](#pageviewport) * [page.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])](#pagewaitforselectororfunctionortimeout-options-args) * [page.waitForFunction(pageFunction[, options[, ...args]])](#pagewaitforfunctionpagefunction-options-args) - * [page.waitForNavigation(options)](#pagewaitfornavigationoptions) - * [page.waitForRequest(urlOrPredicate, options)](#pagewaitforrequesturlorpredicate-options) - * [page.waitForResponse(urlOrPredicate, options)](#pagewaitforresponseurlorpredicate-options) + * [page.waitForNavigation([options])](#pagewaitfornavigationoptions) + * [page.waitForRequest(urlOrPredicate[, options])](#pagewaitforrequesturlorpredicate-options) + * [page.waitForResponse(urlOrPredicate[, options])](#pagewaitforresponseurlorpredicate-options) * [page.waitForSelector(selector[, options])](#pagewaitforselectorselector-options) * [page.waitForXPath(xpath[, options])](#pagewaitforxpathxpath-options) * [page.workers()](#pageworkers) - [class: Worker](#class-worker) - * [worker.evaluate(pageFunction, ...args)](#workerevaluatepagefunction-args) - * [worker.evaluateHandle(pageFunction, ...args)](#workerevaluatehandlepagefunction-args) + * [worker.evaluate(pageFunction[, ...args])](#workerevaluatepagefunction-args) + * [worker.evaluateHandle(pageFunction[, ...args])](#workerevaluatehandlepagefunction-args) * [worker.executionContext()](#workerexecutioncontext) * [worker.url()](#workerurl) - [class: Accessibility](#class-accessibility) @@ -163,12 +163,12 @@ * [keyboard.down(key[, options])](#keyboarddownkey-options) * [keyboard.press(key[, options])](#keyboardpresskey-options) * [keyboard.sendCharacter(char)](#keyboardsendcharacterchar) - * [keyboard.type(text, options)](#keyboardtypetext-options) + * [keyboard.type(text[, options])](#keyboardtypetext-options) * [keyboard.up(key)](#keyboardupkey) - [class: Mouse](#class-mouse) - * [mouse.click(x, y, [options])](#mouseclickx-y-options) + * [mouse.click(x, y[, options])](#mouseclickx-y-options) * [mouse.down([options])](#mousedownoptions) - * [mouse.move(x, y, [options])](#mousemovex-y-options) + * [mouse.move(x, y[, options])](#mousemovex-y-options) * [mouse.up([options])](#mouseupoptions) - [class: Touchscreen](#class-touchscreen) * [touchscreen.tap(x, y)](#touchscreentapx-y) @@ -196,11 +196,11 @@ * [frame.childFrames()](#framechildframes) * [frame.click(selector[, options])](#frameclickselector-options) * [frame.content()](#framecontent) - * [frame.evaluate(pageFunction, ...args)](#frameevaluatepagefunction-args) - * [frame.evaluateHandle(pageFunction, ...args)](#frameevaluatehandlepagefunction-args) + * [frame.evaluate(pageFunction[, ...args])](#frameevaluatepagefunction-args) + * [frame.evaluateHandle(pageFunction[, ...args])](#frameevaluatehandlepagefunction-args) * [frame.executionContext()](#frameexecutioncontext) * [frame.focus(selector)](#framefocusselector) - * [frame.goto(url, options)](#framegotourl-options) + * [frame.goto(url[, options])](#framegotourl-options) * [frame.hover(selector)](#framehoverselector) * [frame.isDetached()](#frameisdetached) * [frame.name()](#framename) @@ -213,12 +213,12 @@ * [frame.url()](#frameurl) * [frame.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]])](#framewaitforselectororfunctionortimeout-options-args) * [frame.waitForFunction(pageFunction[, options[, ...args]])](#framewaitforfunctionpagefunction-options-args) - * [frame.waitForNavigation(options)](#framewaitfornavigationoptions) + * [frame.waitForNavigation([options])](#framewaitfornavigationoptions) * [frame.waitForSelector(selector[, options])](#framewaitforselectorselector-options) * [frame.waitForXPath(xpath[, options])](#framewaitforxpathxpath-options) - [class: ExecutionContext](#class-executioncontext) - * [executionContext.evaluate(pageFunction, ...args)](#executioncontextevaluatepagefunction-args) - * [executionContext.evaluateHandle(pageFunction, ...args)](#executioncontextevaluatehandlepagefunction-args) + * [executionContext.evaluate(pageFunction[, ...args])](#executioncontextevaluatepagefunction-args) + * [executionContext.evaluateHandle(pageFunction[, ...args])](#executioncontextevaluatehandlepagefunction-args) * [executionContext.frame()](#executioncontextframe) * [executionContext.queryObjects(prototypeHandle)](#executioncontextqueryobjectsprototypehandle) - [class: JSHandle](#class-jshandle) @@ -231,8 +231,8 @@ - [class: ElementHandle](#class-elementhandle) * [elementHandle.$(selector)](#elementhandleselector) * [elementHandle.$$(selector)](#elementhandleselector-1) - * [elementHandle.$$eval(selector, pageFunction, ...args)](#elementhandleevalselector-pagefunction-args) - * [elementHandle.$eval(selector, pageFunction, ...args)](#elementhandleevalselector-pagefunction-args-1) + * [elementHandle.$$eval(selector, pageFunction[, ...args])](#elementhandleevalselector-pagefunction-args) + * [elementHandle.$eval(selector, pageFunction[, ...args])](#elementhandleevalselector-pagefunction-args-1) * [elementHandle.$x(expression)](#elementhandlexexpression) * [elementHandle.asElement()](#elementhandleaselement) * [elementHandle.boundingBox()](#elementhandleboundingbox) @@ -300,8 +300,8 @@ * [cdpSession.detach()](#cdpsessiondetach) * [cdpSession.send(method[, params])](#cdpsessionsendmethod-params) - [class: Coverage](#class-coverage) - * [coverage.startCSSCoverage(options)](#coveragestartcsscoverageoptions) - * [coverage.startJSCoverage(options)](#coveragestartjscoverageoptions) + * [coverage.startCSSCoverage([options])](#coveragestartcsscoverageoptions) + * [coverage.startJSCoverage([options])](#coveragestartjscoverageoptions) * [coverage.stopCSSCoverage()](#coveragestopcsscoverage) * [coverage.stopJSCoverage()](#coveragestopjscoverage) - [class: TimeoutError](#class-timeouterror) @@ -1121,7 +1121,7 @@ const [response] = await Promise.all([ Shortcut for [page.mainFrame().click(selector[, options])](#frameclickselector-options). -#### page.close(options) +#### page.close([options]) - `options` <[Object]> - `runBeforeUnload` <[boolean]> Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) @@ -1138,7 +1138,7 @@ By default, `page.close()` **does not** run beforeunload handlers. Gets the full HTML contents of the page, including the doctype. -#### page.cookies(...urls) +#### page.cookies([...urls]) - `...urls` <...[string]> - returns: <[Promise]<[Array]<[Object]>>> - `name` <[string]> @@ -1205,7 +1205,7 @@ List of all available devices is available in the source code: [DeviceDescriptor - `mediaType` Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`. Passing `null` disables media emulation. - returns: <[Promise]> -#### page.evaluate(pageFunction, ...args) +#### page.evaluate(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in the page context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction` @@ -1238,7 +1238,7 @@ await bodyHandle.dispose(); Shortcut for [page.mainFrame().evaluate(pageFunction, ...args)](#frameevaluatepagefunction-args). -#### page.evaluateHandle(pageFunction, ...args) +#### page.evaluateHandle(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in the page context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle) @@ -1262,7 +1262,7 @@ await resultHandle.dispose(); Shortcut for [page.mainFrame().executionContext().evaluateHandle(pageFunction, ...args)](#executioncontextevaluatehandlepagefunction-args). -#### page.evaluateOnNewDocument(pageFunction, ...args) +#### page.evaluateOnNewDocument(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in browser context - `...args` <...[Serializable]> Arguments to pass to `pageFunction` - returns: <[Promise]> @@ -1364,7 +1364,7 @@ Shortcut for [page.mainFrame().focus(selector)](#framefocusselector). #### page.frames() - returns: <[Array]<[Frame]>> An array of all frames attached to the page. -#### page.goBack(options) +#### page.goBack([options]) - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. - `waitUntil` <[string]|[Array]<[string]>> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either: @@ -1377,7 +1377,7 @@ can not go back, resolves to `null`. Navigate to the previous page in history. -#### page.goForward(options) +#### page.goForward([options]) - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. - `waitUntil` <[string]|[Array]<[string]>> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either: @@ -1390,7 +1390,7 @@ can not go forward, resolves to `null`. Navigate to the next page in history. -#### page.goto(url, options) +#### page.goto(url[, options]) - `url` <[string]> URL to navigate page to. The url should include scheme, e.g. `https://`. - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. @@ -1460,7 +1460,7 @@ Page is guaranteed to have a main frame which persists during navigations. - returns: <[Mouse]> -#### page.pdf(options) +#### page.pdf([options]) - `options` <[Object]> Options object which might have the following properties: - `path` <[string]> The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the PDF won't be saved to the disk. - `scale` <[number]> Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2. @@ -1549,7 +1549,7 @@ await mapPrototype.dispose(); Shortcut for [page.mainFrame().executionContext().queryObjects(prototypeHandle)](#executioncontextqueryobjectsprototypehandle). -#### page.reload(options) +#### page.reload([options]) - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. - `waitUntil` <[string]|[Array]<[string]>> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either: @@ -1600,7 +1600,7 @@ Toggles bypassing page's Content-Security-Policy. > **NOTE** CSP bypassing happens at the moment of CSP initialization rather then evaluation. Usually this means that `page.setBypassCSP` should be called before navigating to the domain. -#### page.setCacheEnabled(enabled) +#### page.setCacheEnabled([enabled]) - `enabled` <[boolean]> sets the `enabled` state of the cache. - returns: <[Promise]> @@ -1631,11 +1631,11 @@ await page.setCookie(cookieObject1, cookieObject2); - `timeout` <[number]> Maximum navigation time in milliseconds This setting will change the default maximum navigation time of 30 seconds for the following methods: -- [page.goto(url, options)](#pagegotourl-options) -- [page.goBack(options)](#pagegobackoptions) -- [page.goForward(options)](#pagegoforwardoptions) -- [page.reload(options)](#pagereloadoptions) -- [page.waitForNavigation(options)](#pagewaitfornavigationoptions) +- [page.goto(url[, options])](#pagegotourl-options) +- [page.goBack([options])](#pagegobackoptions) +- [page.goForward([options])](#pagegoforwardoptions) +- [page.reload([options])](#pagereloadoptions) +- [page.waitForNavigation([options])](#pagewaitfornavigationoptions) #### page.setExtraHTTPHeaders(headers) - `headers` <[Object]> An object containing additional HTTP headers to be sent with every request. All header values must be strings. @@ -1835,7 +1835,7 @@ await page.waitForFunction(selector => !!document.querySelector(selector), {}, s Shortcut for [page.mainFrame().waitForFunction(pageFunction[, options[, ...args]])](#framewaitforfunctionpagefunction-options-args). -#### page.waitForNavigation(options) +#### page.waitForNavigation([options]) - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. - `waitUntil` <[string]|[Array]<[string]>> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either: @@ -1859,7 +1859,7 @@ const [response] = await Promise.all([ Shortcut for [page.mainFrame().waitForNavigation(options)](#framewaitfornavigationoptions). -#### page.waitForRequest(urlOrPredicate, options) +#### page.waitForRequest(urlOrPredicate[, options]) - `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for. - `options` <[Object]> Optional waiting parameters - `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. @@ -1871,7 +1871,7 @@ const finalRequest = await page.waitForRequest(request => request.url() === 'htt return firstRequest.url(); ``` -#### page.waitForResponse(urlOrPredicate, options) +#### page.waitForResponse(urlOrPredicate[, options]) - `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for. - `options` <[Object]> Optional waiting parameters - `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. @@ -1961,7 +1961,7 @@ for (const worker of page.workers()) console.log(' ' + worker.url()); ``` -#### worker.evaluate(pageFunction, ...args) +#### worker.evaluate(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in the worker context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction` @@ -1972,7 +1972,7 @@ If the function passed to the `worker.evaluate` returns a non-[Serializable] val Shortcut for [(await worker.executionContext()).evaluate(pageFunction, ...args)](#executioncontextevaluatepagefunction-args). -#### worker.evaluateHandle(pageFunction, ...args) +#### worker.evaluateHandle(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in the page context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle) @@ -2132,7 +2132,7 @@ page.keyboard.sendCharacter('嗨'); > **NOTE** Modifier keys DO NOT effect `keyboard.sendCharacter`. Holding down `Shift` will not type the text in upper case. -#### keyboard.type(text, options) +#### keyboard.type(text[, options]) - `text` <[string]> A text to type into a focused element. - `options` <[Object]> - `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0. @@ -2172,7 +2172,7 @@ await page.mouse.move(0, 0); await page.mouse.up(); ``` -#### mouse.click(x, y, [options]) +#### mouse.click(x, y[, options]) - `x` <[number]> - `y` <[number]> - `options` <[Object]> @@ -2191,7 +2191,7 @@ Shortcut for [`mouse.move`](#mousemovex-y-options), [`mouse.down`](#mousedownopt Dispatches a `mousedown` event. -#### mouse.move(x, y, [options]) +#### mouse.move(x, y[, options]) - `x` <[number]> - `y` <[number]> - `options` <[Object]> @@ -2422,7 +2422,7 @@ const [response] = await Promise.all([ Gets the full HTML contents of the frame, including the doctype. -#### frame.evaluate(pageFunction, ...args) +#### frame.evaluate(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in browser context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction` @@ -2451,7 +2451,7 @@ const html = await frame.evaluate(body => body.innerHTML, bodyHandle); await bodyHandle.dispose(); ``` -#### frame.evaluateHandle(pageFunction, ...args) +#### frame.evaluateHandle(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in the page context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle) @@ -2492,7 +2492,7 @@ Returns promise that resolves to the frame's default execution context. 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) +#### frame.goto(url[, options]) - `url` <[string]> URL to navigate frame to. The url should include scheme, e.g. `https://`. - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. @@ -2646,7 +2646,7 @@ const selector = '.foo'; await page.waitForFunction(selector => !!document.querySelector(selector), {}, selector); ``` -#### frame.waitForNavigation(options) +#### frame.waitForNavigation([options]) - `options` <[Object]> Navigation parameters which might have the following properties: - `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultNavigationTimeout(timeout)](#pagesetdefaultnavigationtimeouttimeout) method. - `waitUntil` <[string]|[Array]<[string]>> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either: @@ -2734,7 +2734,7 @@ The class represents a context for JavaScript execution. A [Page] might have man Besides pages, execution contexts can be found in [workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). -#### executionContext.evaluate(pageFunction, ...args) +#### executionContext.evaluate(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in `executionContext` - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction` @@ -2763,7 +2763,7 @@ await twoHandle.dispose(); console.log(result); // prints '3'. ``` -#### executionContext.evaluateHandle(pageFunction, ...args) +#### executionContext.evaluateHandle(pageFunction[, ...args]) - `pageFunction` <[function]|[string]> Function to be evaluated in the `executionContext` - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[JSHandle]>> Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle) @@ -2908,7 +2908,7 @@ The method runs `element.querySelector` within the page. If no element matches t The method runs `element.querySelectorAll` within the page. If no elements match the selector, the return value resolves to `[]`. -#### elementHandle.$$eval(selector, pageFunction, ...args) +#### elementHandle.$$eval(selector, pageFunction[, ...args]) - `selector` <[string]> A [selector] to query page for - `pageFunction` <[function]> Function to be evaluated in browser context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` @@ -2930,7 +2930,7 @@ const feedHandle = await page.$('.feed'); expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']); ``` -#### elementHandle.$eval(selector, pageFunction, ...args) +#### elementHandle.$eval(selector, pageFunction[, ...args]) - `selector` <[string]> A [selector] to query page for - `pageFunction` <[function]> Function to be evaluated in browser context - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` @@ -3446,12 +3446,12 @@ console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`); _To output coverage in a form consumable by [Istanbul](https://github.com/istanbuljs), see [puppeteer-to-istanbul](https://github.com/istanbuljs/puppeteer-to-istanbul)._ -#### coverage.startCSSCoverage(options) +#### coverage.startCSSCoverage([options]) - `options` <[Object]> Set of configurable options for coverage - `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`. - returns: <[Promise]> Promise that resolves when coverage is started -#### coverage.startJSCoverage(options) +#### coverage.startJSCoverage([options]) - `options` <[Object]> Set of configurable options for coverage - `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`. - `reportAnonymousScripts` <[boolean]> Whether anonymous scripts generated by the page should be reported. Defaults to `false`.