diff --git a/docs/api.md b/docs/api.md index c876a948..981a9e1f 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 32314a1f..2c5d4796 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} */