Table of Contents

Class HttpCommandExecutor

Namespace
OpenQA.Selenium.Remote
Assembly
WebDriver.dll

Provides a way of executing Commands over HTTP

public class HttpCommandExecutor : ICommandExecutor, IDisposable
Inheritance
HttpCommandExecutor
Implements
Inherited Members

Constructors

HttpCommandExecutor(Uri, TimeSpan)

Initializes a new instance of the HttpCommandExecutor class

public HttpCommandExecutor(Uri addressOfRemoteServer, TimeSpan timeout)

Parameters

addressOfRemoteServer Uri

Address of the WebDriver Server

timeout TimeSpan

The timeout within which the server must respond.

HttpCommandExecutor(Uri, TimeSpan, bool)

Initializes a new instance of the HttpCommandExecutor class

public HttpCommandExecutor(Uri addressOfRemoteServer, TimeSpan timeout, bool enableKeepAlive)

Parameters

addressOfRemoteServer Uri

Address of the WebDriver Server

timeout TimeSpan

The timeout within which the server must respond.

enableKeepAlive bool

true if the KeepAlive header should be sent with HTTP requests; otherwise, false.

Exceptions

ArgumentNullException

If addressOfRemoteServer is null.

Properties

CommandInfoRepository

Gets the repository of objects containing information about commands.

protected CommandInfoRepository CommandInfoRepository { get; set; }

Property Value

CommandInfoRepository

Exceptions

ArgumentNullException

If the value is set to null.

IsKeepAliveEnabled

Gets or sets a value indicating whether keep-alive is enabled for HTTP communication between this HttpCommandExecutor and the remote end WebDriver implementation.

public bool IsKeepAliveEnabled { get; set; }

Property Value

bool

Proxy

Gets or sets an IWebProxy object to be used to proxy requests between this HttpCommandExecutor and the remote end WebDriver implementation.

public IWebProxy Proxy { get; set; }

Property Value

IWebProxy

UserAgent

Gets or sets the user agent string used for HTTP communication batween this HttpCommandExecutor and the remote end WebDriver implementation

public string UserAgent { get; set; }

Property Value

string

Methods

Dispose()

Releases all resources used by the HttpCommandExecutor.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the HttpCommandExecutor and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release managed and resources; false to only release unmanaged resources.

Execute(Command)

Executes a command.

public virtual Response Execute(Command commandToExecute)

Parameters

commandToExecute Command

The command you wish to execute.

Returns

Response

A response from the browser.

ExecuteAsync(Command)

Executes a command as an asynchronous task.

public virtual Task<Response> ExecuteAsync(Command commandToExecute)

Parameters

commandToExecute Command

The command you wish to execute.

Returns

Task<Response>

A task object representing the asynchronous operation.

OnSendingRemoteHttpRequest(SendingRemoteHttpRequestEventArgs)

Raises the SendingRemoteHttpRequest event.

protected virtual void OnSendingRemoteHttpRequest(SendingRemoteHttpRequestEventArgs eventArgs)

Parameters

eventArgs SendingRemoteHttpRequestEventArgs

A SendingRemoteHttpRequestEventArgs that contains the event data.

TryAddCommand(string, CommandInfo)

Attempts to add a command to the repository of commands known to this executor.

public bool TryAddCommand(string commandName, CommandInfo info)

Parameters

commandName string

The name of the command to attempt to add.

info CommandInfo

The CommandInfo describing the commnd to add.

Returns

bool

true if the new command has been added successfully; otherwise, false.

Events

SendingRemoteHttpRequest

Occurs when the HttpCommandExecutor is sending an HTTP request to the remote end WebDriver implementation.

public event EventHandler<SendingRemoteHttpRequestEventArgs> SendingRemoteHttpRequest

Event Type

EventHandler<SendingRemoteHttpRequestEventArgs>