Class CommandInfoRepository
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
SpecificationLevel
Gets the level of the W3C WebDriver specification that this repository supports.
public abstract int SpecificationLevel { get; }
Property Value
Methods
FindCommandName(CommandInfo)
Finds a command name for a given CommandInfo.
public string? FindCommandName(CommandInfo commandInfo)
Parameters
commandInfo
CommandInfoThe CommandInfo object for which to find the command name.
Returns
GetCommandInfo<T>(string)
Gets the HttpCommandInfo for a DriverCommand.
public T? GetCommandInfo<T>(string commandName) where T : CommandInfo
Parameters
commandName
stringThe 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
stringThe name of the command to check.
Returns
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
stringName of the command.
commandInfo
TThe command information.
Returns
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.