From 7f3e372b14abc0dc7792f48909c5066476caa4d1 Mon Sep 17 00:00:00 2001 From: theeko Date: Thu, 24 Oct 2019 12:22:21 +0300 Subject: [PATCH] docs(api.md): improve page.waitFor docs for the `options` object (#5021) --- docs/api.md | 6 ++++++ lib/Page.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index c876a94893d..981a9e1ff6c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1965,6 +1965,12 @@ This is a shortcut for [page.mainFrame().url()](#frameurl) #### page.waitFor(selectorOrFunctionOrTimeout[, options[, ...args]]) - `selectorOrFunctionOrTimeout` <[string]|[number]|[function]> A [selector], predicate or timeout to wait for - `options` <[Object]> Optional waiting parameters + - `visible` <[boolean]> wait for element to be present in DOM and to be visible. Defaults to `false`. + - `timeout` <[number]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method. + - `hidden` <[boolean]> wait for element to not be found in the DOM or to be hidden. Defaults to `false`. + - `polling` <[string]|[number]> An interval at which the `pageFunction` is executed, defaults to `raf`. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. If `polling` is a string, then it can be one of the following values: + - `raf` - to constantly execute `pageFunction` in `requestAnimationFrame` callback. This is the tightest polling mode which is suitable to observe styling changes. + - `mutation` - to execute `pageFunction` on every DOM mutation. - `...args` <...[Serializable]|[JSHandle]> Arguments to pass to `pageFunction` - returns: <[Promise]<[JSHandle]>> Promise which resolves to a JSHandle of the success value diff --git a/lib/Page.js b/lib/Page.js index 32314a1f917..2c5d4796dd8 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -1108,7 +1108,7 @@ class Page extends EventEmitter { /** * @param {(string|number|Function)} selectorOrFunctionOrTimeout - * @param {!Object=} options + * @param {!{visible?: boolean, hidden?: boolean, timeout?: number, polling?: string|number}=} options * @param {!Array<*>} args * @return {!Promise} */