Table of Contents

Class QueryPredicatePrototype<TQueryable>

Namespace
CSF.Screenplay.Selenium.Builders
Assembly
CSF.Screenplay.Selenium.dll

A prototype object which may be converted into either a WaitUntilPredicate<T> or an CSF.Specifications.ISpecificationFunction<T>.

public sealed class QueryPredicatePrototype<TQueryable> : IBuildsElementPredicates

Type Parameters

TQueryable

The type of value which is returned by Query.

Inheritance
QueryPredicatePrototype<TQueryable>
Implements
Inherited Members

Remarks

Wait-until predicates and element specifications are conceptually quite similar. Both represent predicates for Selenium elements in one form or another. Becuase of this similarity, it is useful to use just one builder, which is capable of producing either form. This class represents the intermediate form which may be converted into either a wait-until predicate or an element specification.

Constructors

QueryPredicatePrototype(ISpecificationFunction<TQueryable>, IQuery<TQueryable>, ITarget, Func<ITarget, string>, bool)

Initialises a new instance of the QueryPredicatePrototype<TQueryable> class in a manner suitable for using either GetElementSpecification() or GetWaitUntilPredicate().

public QueryPredicatePrototype(ISpecificationFunction<TQueryable> specification, IQuery<TQueryable> query, ITarget target, Func<ITarget, string> summaryCreator, bool multiElement = false)

Parameters

specification ISpecificationFunction<TQueryable>

The specification function for the value returned by the query

query IQuery<TQueryable>

A query which retrieves a value from a Selenium element

target ITarget

The target element or elements

summaryCreator Func<ITarget, string>

A function which creates a summary string for this predicate

multiElement bool

If true, then the target is expected to be a collection of elements

Exceptions

ArgumentNullException

If any nullable parameter is null

Properties

MultiElement

Gets a value indicating whether this predicate is intended to operate upon multiple elements.

public bool MultiElement { get; }

Property Value

bool

Query

Gets the query which will be used to obtain value(s) from the target element(s).

public IQuery<TQueryable> Query { get; }

Property Value

IQuery<TQueryable>

Specification

Gets a specification function which will be evaluated against the value(s) produced by the Query.

public ISpecificationFunction<TQueryable> Specification { get; }

Property Value

ISpecificationFunction<TQueryable>

SummaryCreator

Gets a function which will create a human-readable summary for this predicate, as would appear in Screenplay reports.

public Func<ITarget, string> SummaryCreator { get; }

Property Value

Func<ITarget, string>

Target

Gets the target, which represents one or more Selenium elements upon which this predicate will operate.

public ITarget Target { get; }

Property Value

ITarget

Methods

GetElementSpecification()

Gets a specification function which may be used to filter Selenium elements.

public ISpecificationFunction<SeleniumElement> GetElementSpecification()

Returns

ISpecificationFunction<SeleniumElement>

A specification function for Selenium elements

GetSummary()

Gets a human-readable summary for this predicate, as would appear in Screenplay reports.

public string GetSummary()

Returns

string

A string summary

GetWaitUntilPredicate()

Gets a WaitUntilPredicate<T> which may be used to configure a WaitUntilPredicate<T>.

public WaitUntilPredicate<bool> GetWaitUntilPredicate()

Returns

WaitUntilPredicate<bool>

A wait-until predicate object

Exceptions

InvalidOperationException

If this instance has not been initialised in a manner compatible with creating Web Driver predicates

GetWebDriverPredicate()

Gets a Func<T, TResult> which may be used to evaluate this predicate against a web driver.

public Func<IWebDriver, bool> GetWebDriverPredicate()

Returns

Func<IWebDriver, bool>

A predicate function

Exceptions

InvalidOperationException

If this instance has not been initialised in a manner compatible with creating Web Driver predicates