Class: Response

Response(msgID, respHandler)

Represents the response returned from the remote end after execution of its corresponding command.

The response is a mutable object passed to each command for modification through the available setters. To send data in a response, you modify the body property on the response. The body property can also be replaced completely.

The response is sent implicitly by CommandProcessor when a command has finished executing, and any modifications made subsequent to that will have no effect.

Constructor

new Response(msgID, respHandler)

Parameters:
Name Type Description
msgID number

Message ID tied to the corresponding command request this is a response for.

respHandler ResponseHandler

Function callback called on sending the response.

Source:

Methods

send()

Sends response using the response handler provided on construction.

Source:
Throws:

If the response has already been sent.

Type
RangeError

sendConditionally(predicate)

Sends response conditionally, given a predicate.

Parameters:
Name Type Description
predicate function

A predicate taking a Response object and returning a boolean.

Source:

sendError(err)

Send given Error to client.

Turns the response into an error response, clears any previously set body data, and sends it using the response handler provided on construction.

Parameters:
Name Type Description
err Error

The Error instance to send.

Source:
Throws:

If the {@code error} is not a WebDriverError, the error is propagated.

Type
Error