Class BrowserVersion
- Namespace
- CSF.Extensions.WebDriver.Identification
- Assembly
- CSF.Extensions.WebDriver.dll
Base class for a model which describes a WebDriver browser version.
public abstract class BrowserVersion : IEquatable<BrowserVersion>, IComparable<BrowserVersion>
- Inheritance
-
BrowserVersion
- Implements
- Derived
- Inherited Members
Remarks
Browser version instances are comparable and overload the <
, >
, <=
& >=
operators. It is easy to quickly compare version instances as if they were numbers.
Concrete implementations of BrowserVersion implement the correct rules of commonly-used version numbering systems, including Semantic Versioning, which will correctly parse the version numbers of most common browsers.
Constructors
BrowserVersion(bool)
Initialises a new instance of BrowserVersion.
protected BrowserVersion(bool isPresumed = false)
Parameters
isPresumed
boolWhether or not this is a presumed version; see IsPresumedVersion.
Properties
IsPresumedVersion
Gets a value indicating whether or not the current instance represents a presumed version or not.
public bool IsPresumedVersion { get; }
Property Value
Remarks
When this property is true, this indicates that we are not sure that the version reported by the current BrowserVersion is accurate. This can be the case when the WebDriver implementation does not report-back its version correctly.
A presumed version is created by using the information from the original WebDriver request (based upon the options used to create the driver). It means "We asked for version X, so we presume that it is version X". Of course, across the many scenarios possible, this might not always be correct.
PresumedSuffix
Gets a suffix for derived types' versions which indicates whether or not IsPresumedVersion is true or not.
protected string PresumedSuffix { get; }
Property Value
Methods
CompareTo(BrowserVersion)
public abstract int CompareTo(BrowserVersion other)
Parameters
other
BrowserVersion
Returns
Create(string, string)
Creates a new instance of BrowserVersion from the specified version received from a WebDriver and the version which was requested via the driver options.
public static BrowserVersion Create(string version, string requestedVersion = null)
Parameters
version
stringA browser version string received from a WebDriver
requestedVersion
stringAn optional browser version string which was 'requested' by inclusion in the WebDriver's creation options.
Returns
- BrowserVersion
An implementation of BrowserVersion
Remarks
This method attempts to find the 'best' implementation of BrowserVersion available.
It will try SemanticBrowserVersion and then DottedNumericBrowserVersion for both the
version
and then requestedVersion
before it attempts UnrecognisedBrowserVersion
with either.
Equals(BrowserVersion)
public abstract bool Equals(BrowserVersion other)
Parameters
other
BrowserVersion
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
public override abstract int GetHashCode()
Returns
Operators
operator ==(BrowserVersion, object)
Gets a value indicating whether or not the browser version is equal to the specified object.
public static bool operator ==(BrowserVersion version, object other)
Parameters
version
BrowserVersionA browser version
other
objectAnother object
Returns
operator >(BrowserVersion, BrowserVersion)
Gets a value indicating whether or not one browser version is greater than the other.
public static bool operator >(BrowserVersion first, BrowserVersion second)
Parameters
first
BrowserVersionA browser version
second
BrowserVersionA browser version
Returns
Remarks
operator >=(BrowserVersion, BrowserVersion)
Gets a value indicating whether or not one browser version is greater than or equal to the other.
public static bool operator >=(BrowserVersion first, BrowserVersion second)
Parameters
first
BrowserVersionA browser version
second
BrowserVersionA browser version
Returns
Remarks
operator !=(BrowserVersion, object)
Gets a value indicating whether or not the browser version is not equal to the specified object.
public static bool operator !=(BrowserVersion version, object other)
Parameters
version
BrowserVersionA browser version
other
objectAnother object
Returns
operator <(BrowserVersion, BrowserVersion)
Gets a value indicating whether or not one browser version is less than the other.
public static bool operator <(BrowserVersion first, BrowserVersion second)
Parameters
first
BrowserVersionA browser version
second
BrowserVersionA browser version
Returns
Remarks
operator <=(BrowserVersion, BrowserVersion)
Gets a value indicating whether or not one browser version is less than or equal to the other.
public static bool operator <=(BrowserVersion first, BrowserVersion second)
Parameters
first
BrowserVersionA browser version
second
BrowserVersionA browser version