Document all options objects wherever they are used (#139)

This patch adds missing documentation for all the shortcut methods, such as
`page.evaluate` or `page.waitForSelector`.

closes #114
This commit is contained in:
JoelEinbinder 2017-07-25 21:01:05 -07:00 committed by Andrey Lushnikov
parent 83f4e43564
commit 81d4b8f4f8

View File

@ -388,14 +388,26 @@ The function is invoked after the document was created but before any of its scr
- returns: <[Array]<[Frame]>> An array of all frames attached to the page. - returns: <[Array]<[Frame]>> An array of all frames attached to the page.
#### page.goBack(options) #### page.goBack(options)
- `options` <[Object]> Navigation parameters, same as in [page.navigate](#pagenavigateurl-options). - `options` <[Object]> Navigation parameters which might have the following properties:
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds.
- `waitUntil` <[string]> When to consider navigation succeeded, defaults to `load`. Could be either:
- `load` - consider navigation to be finished when the `load` event is fired.
- `networkidle` - consider navigation to be finished when the network activity stays "idle" for at least `networkIdleTimeout`ms.
- `networkIdleInflight` <[number]> Maximum amount of inflight requests which are considered "idle". Takes effect only with `waitUntil: 'networkidle'` parameter.
- `networkIdleTimeout` <[number]> A timeout to wait before completing navigation. Takes effect only with `waitUntil: 'networkidle'` parameter.
- returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If - returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If
can not go back, resolves to null. can not go back, resolves to null.
Navigate to the previous page in history. Navigate to the previous page in history.
#### page.goForward(options) #### page.goForward(options)
- `options` <[Object]> Navigation parameters, same as in [page.navigate](#pagenavigateurl-options). - `options` <[Object]> Navigation parameters which might have the following properties:
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds.
- `waitUntil` <[string]> When to consider navigation succeeded, defaults to `load`. Could be either:
- `load` - consider navigation to be finished when the `load` event is fired.
- `networkidle` - consider navigation to be finished when the network activity stays "idle" for at least `networkIdleTimeout`ms.
- `networkIdleInflight` <[number]> Maximum amount of inflight requests which are considered "idle". Takes effect only with `waitUntil: 'networkidle'` parameter.
- `networkIdleTimeout` <[number]> A timeout to wait before completing navigation. Takes effect only with `waitUntil: 'networkidle'` parameter.
- returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If - returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. If
can not go back, resolves to null. can not go back, resolves to null.
@ -493,7 +505,13 @@ The `format` options are:
Shortcut for [`keyboard.down`](#keyboarddownkey) and [`keyboard.up`](#keyboardupkey). Shortcut for [`keyboard.down`](#keyboarddownkey) and [`keyboard.up`](#keyboardupkey).
#### page.reload(options) #### page.reload(options)
- `options` <[Object]> Navigation parameters, same as in [page.navigate](#pagenavigateurl-options). - `options` <[Object]> Navigation parameters which might have the following properties:
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds.
- `waitUntil` <[string]> When to consider navigation succeeded, defaults to `load`. Could be either:
- `load` - consider navigation to be finished when the `load` event is fired.
- `networkidle` - consider navigation to be finished when the network activity stays "idle" for at least `networkIdleTimeout`ms.
- `networkIdleInflight` <[number]> Maximum amount of inflight requests which are considered "idle". Takes effect only with `waitUntil: 'networkidle'` parameter.
- `networkIdleTimeout` <[number]> A timeout to wait before completing navigation. Takes effect only with `waitUntil: 'networkidle'` parameter.
- returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. - returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
#### page.screenshot([options]) #### page.screenshot([options])
@ -609,6 +627,8 @@ This is a shortcut for [page.mainFrame().url()](#frameurl)
#### page.waitFor(selectorOrTimeout[, options]) #### page.waitFor(selectorOrTimeout[, options])
- `selectorOrTimeout` <[string]|[number]> A selector or timeout to wait for - `selectorOrTimeout` <[string]|[number]> A selector or timeout to wait for
- `options` <[Object]> Optional waiting parameters - `options` <[Object]> Optional waiting parameters
- `visible` <[boolean]> wait for element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `timeout` <[number]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds).
- returns: <[Promise]> - returns: <[Promise]>
This method behaves differently with respect to the type of the first parameter: This method behaves differently with respect to the type of the first parameter:
@ -619,12 +639,20 @@ This method behaves differently with respect to the type of the first parameter:
The method is a shortcut for [page.mainFrame().waitFor()](#framewaitfortargetoptions). The method is a shortcut for [page.mainFrame().waitFor()](#framewaitfortargetoptions).
#### page.waitForNavigation(options) #### page.waitForNavigation(options)
- `options` <[Object]> Navigation parameters, same as in [page.navigate](#pagenavigateurl-options). - `options` <[Object]> Navigation parameters which might have the following properties:
- `timeout` <[number]> Maximum navigation time in milliseconds, defaults to 30 seconds.
- `waitUntil` <[string]> When to consider navigation succeeded, defaults to `load`. Could be either:
- `load` - consider navigation to be finished when the `load` event is fired.
- `networkidle` - consider navigation to be finished when the network activity stays "idle" for at least `networkIdleTimeout`ms.
- `networkIdleInflight` <[number]> Maximum amount of inflight requests which are considered "idle". Takes effect only with `waitUntil: 'networkidle'` parameter.
- `networkIdleTimeout` <[number]> A timeout to wait before completing navigation. Takes effect only with `waitUntil: 'networkidle'` parameter.
- returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. - returns: <[Promise]<[Response]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
#### page.waitForSelector(selector[, options]) #### page.waitForSelector(selector[, options])
- `selector` <[string]> A query selector to wait for on the page. - `selector` <[string]> A query selector to wait for on the page.
- `options` <[Object]> Optional waiting parameters. Same as options for the [frame.waitFor](#framewaitforselector) - `options` <[Object]> Optional waiting parameters
- `visible` <[boolean]> wait for element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `timeout` <[number]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds).
- returns: <[Promise]> Promise which resolves when the element matching `selector` appears in the page. - returns: <[Promise]> Promise which resolves when the element matching `selector` appears in the page.
Shortcut for [page.mainFrame().waitForSelector()](#framewaitforselectorselectoroptions). Shortcut for [page.mainFrame().waitForSelector()](#framewaitforselectorselectoroptions).
@ -858,6 +886,8 @@ Returns frame's url.
#### frame.waitFor(selectorOrTimeout[, options]) #### frame.waitFor(selectorOrTimeout[, options])
- `selectorOrTimeout` <[string]|[number]> A selector or timeout to wait for - `selectorOrTimeout` <[string]|[number]> A selector or timeout to wait for
- `options` <[Object]> Optional waiting parameters - `options` <[Object]> Optional waiting parameters
- `visible` <[boolean]> wait for element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `timeout` <[number]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds).
- returns: <[Promise]> - returns: <[Promise]>
This method behaves differently with respect to the type of the first parameter: This method behaves differently with respect to the type of the first parameter: