CSF.Screenplay.Selenium Extension
The Selenium extension allows Actors to control web browsers using Selenium WebDriver technology. The control of web browsers in this manner is the origin of the Screenplay pattern, in which it was an improvement and thorough refactoring of the older Page Object pattern.
Core contents of this extension
Like many extensions, the Selenium extension provides:
- The Ability
BrowseTheWeb, which provides access to the WebDriver API - Several Actions, which allow an actor to interact with the web page
- Several Questions, which allow an actor to read or observe the web page
- Tasks, for commonly-performed combinations of actions & questions
- Models representing the UI, URLs and areas of the page
- The
NamedUriclass is used to navigate to specific pages - Types which provide references to HTML elements on the page, deriving from
ITarget
- The
Many of the Performables provided by this extension operate in the format "Actor performs X vaction upon Y element". A core benefit of Screenplay (over Page Object pattern) is the separation of the functionality (the logic of the interaction) and the UI elements (the target of the interaction). This improves reusability and composability.
Additional contents
The types listed above are the core of the Selenium plugin, but there's more available.
- This extension integrates with the Browser Quirks feature of CSF.Extensions.WebDriver. That allows it to provide integrated workarounds for the quirks of some browsers. These workarounds are amongst the Tasks noted above.
- This extension provides a
Colorstruct which provides a cross-browser way of describing sRGB color and testing for equality. - For occasions on which JavaScript must be sent to the browser, this extension provides Named Script classes which offer a type-safe mechanism to refer to those scripts from .NET code.
- If the default wait timeout of 5 seconds is unsuitable, the ability
UseADefaultWaitTimemay be used to specify a default timeout suitable for your use-case.