Table of Contents

Class CommandInfoRepository

Namespace
OpenQA.Selenium
Assembly
WebDriver.dll

Holds the information about all commands specified by the JSON wire protocol. This class cannot be inherited, as it is intended to be a singleton, and allowing subclasses introduces the possibility of multiple instances.

public abstract class CommandInfoRepository
Inheritance
CommandInfoRepository
Derived
Inherited Members

Constructors

CommandInfoRepository()

Initializes a new instance of the CommandInfoRepository class. Protected accessibility prevents a default instance from being created.

protected CommandInfoRepository()

Properties

RepositoryCommandInfoType

Gets the Type that is valid for this CommandInfoRepository

protected abstract Type RepositoryCommandInfoType { get; }

Property Value

Type

SpecificationLevel

Gets the level of the W3C WebDriver specification that this repository supports.

public abstract int SpecificationLevel { get; }

Property Value

int

Methods

FindCommandName(CommandInfo)

Finds a command name for a given CommandInfo.

public string? FindCommandName(CommandInfo commandInfo)

Parameters

commandInfo CommandInfo

The CommandInfo object for which to find the command name.

Returns

string

The name of the command defined by the command info, or null if the command is not defined.

GetCommandInfo<T>(string)

public T? GetCommandInfo<T>(string commandName) where T : CommandInfo

Parameters

commandName string

The DriverCommand for which to get the information.

Returns

T

The HttpCommandInfo for the specified command, or null if not found or value is not T.

Type Parameters

T

InitializeCommandDictionary()

Initializes the dictionary of commands for the CommandInfoRepository

protected abstract void InitializeCommandDictionary()

IsCommandNameDefined(string)

Gets a value indicating whether a command with a given name has been defined.

public bool IsCommandNameDefined(string commandName)

Parameters

commandName string

The name of the command to check.

Returns

bool

true if the command name is defined

Exceptions

ArgumentNullException

If commandName is null.

TryAddCommand<T>(string, T)

Tries to add a command to the list of known commands.

public bool TryAddCommand<T>(string commandName, T commandInfo) where T : CommandInfo

Parameters

commandName string

Name of the command.

commandInfo T

The command information.

Returns

bool

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

Type Parameters

T

Remarks

This method is used by WebDriver implementations to add additional custom driver-specific commands. This method will not overwrite existing commands for a specific name, and will return false in that case.

Exceptions

ArgumentNullException

If commandName is null or Empty.

-or-

If commandInfo is null.

ArgumentException

If T is not a valid command type for this repository.