chore: update request and response references in docs (#5942)
Missed some Request => HTTPRequest and Response => HTTPResponse renames when updating the docs.
This commit is contained in:
parent
232def0dcf
commit
78624842ef
38
docs/api.md
38
docs/api.md
@ -1079,25 +1079,25 @@ const [popup] = await Promise.all([
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### event: 'request'
|
#### event: 'request'
|
||||||
- <[Request]>
|
- <[HTTPRequest]>
|
||||||
|
|
||||||
Emitted when a page issues a request. The [request] object is read-only.
|
Emitted when a page issues a request. The [request] object is read-only.
|
||||||
In order to intercept and mutate requests, see `page.setRequestInterception`.
|
In order to intercept and mutate requests, see `page.setRequestInterception`.
|
||||||
|
|
||||||
#### event: 'requestfailed'
|
#### event: 'requestfailed'
|
||||||
- <[Request]>
|
- <[HTTPRequest]>
|
||||||
|
|
||||||
Emitted when a request fails, for example by timing out.
|
Emitted when a request fails, for example by timing out.
|
||||||
|
|
||||||
> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`'requestfinished'`](#event-requestfinished) event and not with [`'requestfailed'`](#event-requestfailed).
|
> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [`'requestfinished'`](#event-requestfinished) event and not with [`'requestfailed'`](#event-requestfailed).
|
||||||
|
|
||||||
#### event: 'requestfinished'
|
#### event: 'requestfinished'
|
||||||
- <[Request]>
|
- <[HTTPRequest]>
|
||||||
|
|
||||||
Emitted when a request finishes successfully.
|
Emitted when a request finishes successfully.
|
||||||
|
|
||||||
#### event: 'response'
|
#### event: 'response'
|
||||||
- <[Response]>
|
- <[HTTPResponse]>
|
||||||
|
|
||||||
Emitted when a [response] is received.
|
Emitted when a [response] is received.
|
||||||
|
|
||||||
@ -1594,7 +1594,7 @@ Shortcut for [page.mainFrame().focus(selector)](#framefocusselector).
|
|||||||
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- 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]<?[HTTPResponse]>> 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.
|
||||||
@ -1607,7 +1607,7 @@ Navigate to the previous page in history.
|
|||||||
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- 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]<?[HTTPResponse]>> 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 forward, resolves to `null`.
|
can not go forward, resolves to `null`.
|
||||||
|
|
||||||
Navigate to the next page in history.
|
Navigate to the next page in history.
|
||||||
@ -1622,7 +1622,7 @@ Navigate to the next page in history.
|
|||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).
|
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).
|
||||||
- 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]<?[HTTPResponse]>> 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.goto` will throw an error if:
|
`page.goto` will throw an error if:
|
||||||
- there's an SSL error (e.g. in case of self-signed certificates).
|
- there's an SSL error (e.g. in case of self-signed certificates).
|
||||||
@ -1782,7 +1782,7 @@ Shortcut for [page.mainFrame().executionContext().queryObjects(prototypeHandle)]
|
|||||||
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- 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]<[HTTPResponse]>> 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])
|
||||||
- `options` <[Object]> Options object which might have the following properties:
|
- `options` <[Object]> Options object which might have the following properties:
|
||||||
@ -2157,7 +2157,7 @@ Shortcut for [page.mainFrame().waitForFunction(pageFunction[, options[, ...args]
|
|||||||
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- 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. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.
|
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.
|
||||||
|
|
||||||
This resolves when the page navigates to a new URL or reloads. It is useful for when you run code
|
This resolves when the page navigates to a new URL or reloads. It is useful for when you run code
|
||||||
which will indirectly cause the page to navigate. Consider this example:
|
which will indirectly cause the page to navigate. Consider this example:
|
||||||
@ -2177,7 +2177,7 @@ Shortcut for [page.mainFrame().waitForNavigation(options)](#framewaitfornavigati
|
|||||||
- `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for.
|
- `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for.
|
||||||
- `options` <[Object]> Optional waiting parameters
|
- `options` <[Object]> Optional waiting parameters
|
||||||
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
|
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
|
||||||
- returns: <[Promise]<[Request]>> Promise which resolves to the matched request.
|
- returns: <[Promise]<[HTTPRequest]>> Promise which resolves to the matched request.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const firstRequest = await page.waitForRequest('http://example.com/resource');
|
const firstRequest = await page.waitForRequest('http://example.com/resource');
|
||||||
@ -2189,7 +2189,7 @@ return firstRequest.url();
|
|||||||
- `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for.
|
- `urlOrPredicate` <[string]|[Function]> A URL or predicate to wait for.
|
||||||
- `options` <[Object]> Optional waiting parameters
|
- `options` <[Object]> Optional waiting parameters
|
||||||
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
|
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) method.
|
||||||
- returns: <[Promise]<[Response]>> Promise which resolves to the matched response.
|
- returns: <[Promise]<[HTTPResponse]>> Promise which resolves to the matched response.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const firstResponse = await page.waitForResponse('https://example.com/resource');
|
const firstResponse = await page.waitForResponse('https://example.com/resource');
|
||||||
@ -2861,7 +2861,7 @@ If there's no element matching `selector`, the method throws an error.
|
|||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).
|
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).
|
||||||
- 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]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
|
||||||
|
|
||||||
`frame.goto` will throw an error if:
|
`frame.goto` will throw an error if:
|
||||||
- there's an SSL error (e.g. in case of self-signed certificates).
|
- there's an SSL error (e.g. in case of self-signed certificates).
|
||||||
@ -3024,7 +3024,7 @@ await page.waitForFunction(selector => !!document.querySelector(selector), {}, s
|
|||||||
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
- `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
|
||||||
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
- `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
|
||||||
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
- `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
|
||||||
- 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. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.
|
- returns: <[Promise]<?[HTTPResponse]>> Promise which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will resolve with `null`.
|
||||||
|
|
||||||
This resolves when the frame navigates to a new URL. It is useful for when you run code
|
This resolves when the frame navigates to a new URL. It is useful for when you run code
|
||||||
which will indirectly cause the frame to navigate. Consider this example:
|
which will indirectly cause the frame to navigate. Consider this example:
|
||||||
@ -3642,7 +3642,7 @@ Whether this request is driving frame's navigation.
|
|||||||
- returns: <[string]> Request's post body, if any.
|
- returns: <[string]> Request's post body, if any.
|
||||||
|
|
||||||
#### httpRequest.redirectChain()
|
#### httpRequest.redirectChain()
|
||||||
- returns: <[Array]<[Request]>>
|
- returns: <[Array]<[HTTPRequest]>>
|
||||||
|
|
||||||
A `redirectChain` is a chain of requests initiated to fetch a resource.
|
A `redirectChain` is a chain of requests initiated to fetch a resource.
|
||||||
- If there are no redirects and the request was successful, the chain will be empty.
|
- If there are no redirects and the request was successful, the chain will be empty.
|
||||||
@ -3703,14 +3703,14 @@ page.on('request', request => {
|
|||||||
> Calling `request.respond` for a dataURL request is a noop.
|
> Calling `request.respond` for a dataURL request is a noop.
|
||||||
|
|
||||||
#### httpRequest.response()
|
#### httpRequest.response()
|
||||||
- returns: <?[Response]> A matching [Response] object, or `null` if the response has not been received yet.
|
- returns: <?[HTTPResponse]> A matching [HTTPResponse] object, or `null` if the response has not been received yet.
|
||||||
|
|
||||||
#### httpRequest.url()
|
#### httpRequest.url()
|
||||||
- returns: <[string]> URL of the request.
|
- returns: <[string]> URL of the request.
|
||||||
|
|
||||||
### class: HTTPResponse
|
### class: HTTPResponse
|
||||||
|
|
||||||
[Response] class represents responses which are received by page.
|
[HTTPResponse] class represents responses which are received by page.
|
||||||
|
|
||||||
#### httpResponse.buffer()
|
#### httpResponse.buffer()
|
||||||
- returns: <Promise<[Buffer]>> Promise which resolves to a buffer with response body.
|
- returns: <Promise<[Buffer]>> Promise which resolves to a buffer with response body.
|
||||||
@ -3747,7 +3747,7 @@ Contains a boolean stating whether the response was successful (status in the ra
|
|||||||
- `port` <[number]> the port used to connect to the remote server
|
- `port` <[number]> the port used to connect to the remote server
|
||||||
|
|
||||||
#### httpResponse.request()
|
#### httpResponse.request()
|
||||||
- returns: <[Request]> A matching [Request] object.
|
- returns: <[HTTPRequest]> A matching [HTTPRequest] object.
|
||||||
|
|
||||||
#### httpResponse.securityDetails()
|
#### httpResponse.securityDetails()
|
||||||
- returns: <?[SecurityDetails]> Security details if the response was received over the secure connection, or `null` otherwise.
|
- returns: <?[SecurityDetails]> Security details if the response was received over the secure connection, or `null` otherwise.
|
||||||
@ -4000,8 +4000,8 @@ This method is identical to `off` and maintained for compatibility with Node's E
|
|||||||
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
|
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
|
||||||
[Page]: #class-page "Page"
|
[Page]: #class-page "Page"
|
||||||
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
|
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
|
||||||
[Request]: #class-request "Request"
|
[HTTPRequest]: #class-request "HTTPRequest"
|
||||||
[Response]: #class-response "Response"
|
[HTTPResponse]: #class-response "HTTPRHTTPesponse"
|
||||||
[SecurityDetails]: #class-securitydetails "SecurityDetails"
|
[SecurityDetails]: #class-securitydetails "SecurityDetails"
|
||||||
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
|
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
|
||||||
[Target]: #class-target "Target"
|
[Target]: #class-target "Target"
|
||||||
|
Loading…
Reference in New Issue
Block a user