Table of Contents

Class Response

Namespace
OpenQA.Selenium
Assembly
WebDriver.dll

Handles reponses from the browser

public class Response
Inheritance
Response
Inherited Members

Constructors

Response()

Initializes a new instance of the Response class

[Obsolete("Set all values using the Response(string, object, WebDriverResult) constructor instead. This constructor will be removed in Selenium 4.30")]
public Response()

Response(SessionId?)

Initializes a new instance of the Response class

[Obsolete("Set all values using the Response(string, object, WebDriverResult) constructor instead. This constructor will be removed in Selenium 4.30")]
public Response(SessionId? sessionId)

Parameters

sessionId SessionId

Session ID in use

Response(string?, object?, WebDriverResult)

Initializes a new instance of the Response class

public Response(string? sessionId, object? value, WebDriverResult status)

Parameters

sessionId string

The Session ID in use, if any.

value object

The JSON payload of the response.

status WebDriverResult

The WebDriver result status of the response.

Properties

SessionId

Gets or sets the session ID.

public string? SessionId { get; set; }

Property Value

string

Status

Gets or sets the status value of the response.

public WebDriverResult Status { get; set; }

Property Value

WebDriverResult

Value

Gets or sets the value from JSON.

public object? Value { get; set; }

Property Value

object

Methods

FromErrorJson(string)

Returns a new Response from a JSON-encoded string.

public static Response FromErrorJson(string value)

Parameters

value string

The JSON string to deserialize into a Response.

Returns

Response

A Response object described by the JSON string.

Exceptions

ArgumentNullException

If value is null.

JsonException

If value is not a valid JSON object.

WebDriverException

If the JSON dictionary is not in the expected state, per spec.

FromJson(string)

Returns a new Response from a JSON-encoded string.

public static Response FromJson(string value)

Parameters

value string

The JSON string to deserialize into a Response.

Returns

Response

A Response object described by the JSON string.

Exceptions

ArgumentNullException

If value is null.

JsonException

If value is not a valid JSON object.

ToJson()

Returns this object as a JSON-encoded string.

public string ToJson()

Returns

string

A JSON-encoded string representing this Response object.

ToString()

Returns the object as a string.

public override string ToString()

Returns

string

A string with the Session ID, status value, and the value from JSON.