Class SingleElementQuery<TResult>
- Namespace
- CSF.Screenplay.Selenium.Questions
- Assembly
- CSF.Screenplay.Selenium.dll
An implementation of ISingleElementPerformableWithResult<TResult> which gets the value from an IQuery<T> upon a single Selenium element and returns its result.
public class SingleElementQuery<TResult> : ISingleElementPerformableWithResult<TResult>, ICanReportForElement
Type Parameters
TResultThe type of the result returned by the query.
- Inheritance
-
SingleElementQuery<TResult>
- Implements
-
ISingleElementPerformableWithResult<TResult>
- Inherited Members
Constructors
SingleElementQuery(IQuery<TResult>)
Initializes a new instance of the SingleElementQuery<TResult> class with the specified query.
public SingleElementQuery(IQuery<TResult> query)
Parameters
queryIQuery<TResult>The query to be used for retrieving the value from the Selenium element.
Methods
GetReportFragment(Actor, Lazy<SeleniumElement>, IFormatsReportFragment)
Counterpart to GetReportFragment(Actor, IFormatsReportFragment) except that this method also offers a Selenium element.
public ReportFragment GetReportFragment(Actor actor, Lazy<SeleniumElement> element, IFormatsReportFragment formatter)
Parameters
actorActorAn actor for whom to write the report fragment
elementLazy<SeleniumElement>The Selenium element for which the report is being written
formatterIFormatsReportFragmentA report-formatting service
Returns
- ReportFragment
A human-readable report fragment.
Remarks
Please see the documentation for GetReportFragment(Actor, IFormatsReportFragment) for more information.
PerformAsAsync(ICanPerform, IWebDriver, Lazy<SeleniumElement>, CancellationToken)
Counterpart to PerformAsAsync(ICanPerform, CancellationToken) except that this method also offers a Selenium WebDriver and element.
public ValueTask<TResult> PerformAsAsync(ICanPerform actor, IWebDriver webDriver, Lazy<SeleniumElement> element, CancellationToken cancellationToken = default)
Parameters
actorICanPerformThe actor that is performing.
webDriverIWebDriverThe Selenium WebDriver provided from the actor's abilities.
elementLazy<SeleniumElement>The single Selenium Element upon which this method should operate.
cancellationTokenCancellationTokenAn optional cancellation token by which to abort the performable.
Returns
- ValueTask<TResult>
A task which exposes a strongly-typed 'result' value when the performable represented by the current instance is complete.