Class HttpCommandExecutor
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
addressOfRemoteServerUriAddress of the WebDriver Server
timeoutTimeSpanThe timeout within which the server must respond.
Exceptions
- ArgumentNullException
If
addressOfRemoteServeris null.
HttpCommandExecutor(Uri, TimeSpan, bool)
Initializes a new instance of the HttpCommandExecutor class
public HttpCommandExecutor(Uri addressOfRemoteServer, TimeSpan timeout, bool enableKeepAlive)
Parameters
addressOfRemoteServerUriAddress of the WebDriver Server
timeoutTimeSpanThe timeout within which the server must respond.
enableKeepAlivebooltrue if the KeepAlive header should be sent with HTTP requests; otherwise, false.
Exceptions
- ArgumentNullException
If
addressOfRemoteServeris null.
Properties
CommandInfoRepository
Gets the repository of objects containing information about commands.
protected CommandInfoRepository CommandInfoRepository { get; set; }
Property Value
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
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
UserAgent
Gets or sets the user agent string used for HTTP communication between this HttpCommandExecutor and the remote end WebDriver implementation
public string UserAgent { get; set; }
Property Value
Methods
CreateHttpClient()
Creates an instance of HttpClient used by making all HTTP calls to remote end. Invoked only once when required.
protected virtual HttpClient CreateHttpClient()
Returns
- HttpClient
An instance of HttpClient.
CreateHttpClientHandler()
Creates an instance of HttpClientHandler as underlying handler, used by CreateHttpClient(). Invoked only once when required.
protected virtual HttpClientHandler CreateHttpClientHandler()
Returns
- HttpClientHandler
An instance of HttpClientHandler.
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
Execute(Command)
Executes a command.
public virtual Response Execute(Command commandToExecute)
Parameters
commandToExecuteCommandThe command you wish to execute.
Returns
- Response
A response from the browser.
Exceptions
- ArgumentNullException
If
commandToExecuteis null.
ExecuteAsync(Command)
Executes a command as an asynchronous task.
public virtual Task<Response> ExecuteAsync(Command commandToExecute)
Parameters
commandToExecuteCommandThe command you wish to execute.
Returns
Exceptions
- ArgumentNullException
If
commandToExecuteis null.
OnSendingRemoteHttpRequest(SendingRemoteHttpRequestEventArgs)
Raises the SendingRemoteHttpRequest event.
protected virtual void OnSendingRemoteHttpRequest(SendingRemoteHttpRequestEventArgs eventArgs)
Parameters
eventArgsSendingRemoteHttpRequestEventArgsA 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
commandNamestringThe name of the command to attempt to add.
infoCommandInfoThe CommandInfo describing the command to add.
Returns
Events
SendingRemoteHttpRequest
Occurs when the HttpCommandExecutor is sending an HTTP request to the remote end WebDriver implementation.
public event EventHandler<SendingRemoteHttpRequestEventArgs>? SendingRemoteHttpRequest