Constructor
new Network(driver, browsingContextIds)
Represents a Network object.
Name | Type | Description |
---|---|---|
driver | Driver | The driver to fetch the BiDi connection. |
browsingContextIds | Array | An array of browsing context IDs that the network events will be subscribed to. |
- Source
Methods
(async) addIntercept(params) → {Promise.<string>}
Adds a network intercept.
Name | Type | Description |
---|---|---|
params | AddInterceptParameters | The parameters for the network intercept. |
- Source
- If params is not an instance of AddInterceptParameters.
- Type
- Error
- A promise that resolves to the added intercept's id.
- Type:
- Promise.<string>
(async) authRequired(callback) → {Promise.<number>}
Subscribes to the 'network.authRequired' event and handles it with the provided callback.
Name | Type | Description |
---|---|---|
callback | function | The callback function to handle the event. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<number>
(async) beforeRequestSent(callback) → {Promise.<void>}
Subscribes to the 'network.beforeRequestSent' event and handles it with the provided callback.
Name | Type | Description |
---|---|---|
callback | function | The callback function to handle the event. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>
(async) cancelAuth(requestId) → {Promise.<void>}
Cancels the authentication for a specific request.
Name | Type | Description |
---|---|---|
requestId | string | The ID of the request to cancel authentication for. |
- Source
- A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) close() → {Promise.<void>}
Unsubscribes from network events for all browsing contexts.
- Source
A promise that resolves when the network connection is closed.
- Type:
- Promise.<void>
(async) continueRequest(params) → {Promise.<void>}
Continues the network request with the provided parameters.
Name | Type | Description |
---|---|---|
params | ContinueRequestParameters | The parameters for continuing the request. |
- Source
If params is not an instance of ContinueRequestParameters.
- Type
- Error
A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) continueResponse(params) → {Promise.<void>}
Continues the network response with the given parameters.
Name | Type | Description |
---|---|---|
params | ContinueResponseParameters | The parameters for continuing the response. |
- Source
If params is not an instance of ContinueResponseParameters.
- Type
- Error
A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) continueWithAuth(requestId, username, password) → {Promise.<void>}
Continues the network request with authentication credentials.
Name | Type | Description |
---|---|---|
requestId | string | The ID of the request to continue. |
username | string | The username for authentication. |
password | string | The password for authentication. |
- Source
- A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) continueWithAuthNoCredentials(requestId) → {Promise.<void>}
Continues the network request with authentication but without providing credentials.
Name | Type | Description |
---|---|---|
requestId | string | The ID of the request to continue with authentication. |
- Source
- A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) failRequest(requestId) → {Promise.<void>}
Fails a network request.
Name | Type | Description |
---|---|---|
requestId | number | The ID of the request to fail. |
- Source
- A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) fetchError(callback) → {Promise.<void>}
Subscribes to the 'network.fetchError' event and handles it with the provided callback.
Name | Type | Description |
---|---|---|
callback | function | The callback function to handle the event. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>
(async) provideResponse(params) → {Promise.<void>}
Provides a response for the network.
Name | Type | Description |
---|---|---|
params | ProvideResponseParameters | The parameters for providing the response. |
- Source
If params is not an instance of ProvideResponseParameters.
- Type
- Error
A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) removeIntercept(interceptId) → {Promise.<void>}
Removes an intercept.
Name | Type | Description |
---|---|---|
interceptId | string | The ID of the intercept to be removed. |
- Source
- A promise that resolves when the intercept is successfully removed.
- Type:
- Promise.<void>
(async) responseCompleted(callback) → {Promise.<void>}
Subscribes to the 'network.responseCompleted' event and handles it with the provided callback.
Name | Type | Description |
---|---|---|
callback | function | The callback function to handle the event. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>
(async) responseStarted(callback) → {Promise.<void>}
Subscribes to the 'network.responseStarted' event and handles it with the provided callback.
Name | Type | Description |
---|---|---|
callback | function | The callback function to handle the event. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>