docs(api.md): improve page.waitFor docs for the options object (#5021)

This commit is contained in:
theeko 2019-10-24 12:22:21 +03:00 committed by Mathias Bynens
parent 8132b39a6c
commit 7f3e372b14
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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<!Puppeteer.JSHandle>}
*/