Table of Contents

Interface IHasQuirks

Namespace
CSF.Extensions.WebDriver.Quirks
Assembly
CSF.Extensions.WebDriver.dll

An object which can indicate whether or not it is affected by specified browser quirks.

public interface IHasQuirks

Remarks

There are many implementations of OpenQA.Selenium.IWebDriver, each representing a different web browser. Due to design choices in these web browsers, differences in OS platform and perhaps even bugs in some versions of the browser or WebDriver implementations, browsers might exhibit quirky behaviour which differs from the uniform results which a perfect implementation would be expected to provide.

This 'quirks' mechanism provides a way in which consumers of WebDrivers may gracefully deal with that, with minimal compromise to their design. A quirk is a named boolean flag, such as (a fictitious quirk) CannotDisplayYellow. Consumers of the WebDriver may use this interface to determine whether or not the WebDriver is affected by this quirk or not, by using the HasQuirk(IWebDriver, string) function. If the WebDriver is known to be affected by the quirk then that method will return true, or if it is not affected then the method will return false. The consumer may then take whatever course of action is required in order to work-around that quirk, if the result was true.

The implementation of this interface uses the BrowserId present on the WebDriver to identify it. It then cross-references this with source data which lists which browser, platform and version ranges are affected by which quirks. It is intended that the source data listing the quirks and which browsers, platforms & browser version-ranges are affected come from configuration data. This way new quirks may be added without requiring code-changes. Quirks which are no longer relevant (for example, a bug is patched) may also be retired via configuration.

The actual names of the quirks may be completely arbitrary strings. Where possible it should be a semi-human-readable identification of a piece of functionality which does not work in the expected/common manner. IE: It should indicate something that a particular WebDriver or browser implementation cannot do, or that requires a specific workaround in order to achieve the same results as other WebDriver/browser implementations.

Properties

AllQuirks

Gets a collection of the names of all of the quirks which affect the current object.

IReadOnlyCollection<string> AllQuirks { get; }

Property Value

IReadOnlyCollection<string>

Remarks

Prefer using HasQuirk(IWebDriver, string) instead of this property.