Table of Contents

Class NamedScript<T1, T2, T3, T4, T5, T6, T7>

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

A model representing a pre-written piece of executable JavaScript, which accepts 7 parameters and which returns no result.

public class NamedScript<T1, T2, T3, T4, T5, T6, T7> : NamedScriptBasis, IHasName

Type Parameters

T1

The type of the first parameter

T2

The type of the second parameter

T3

The type of the third parameter

T4

The type of the fourth parameter

T5

The type of the fifth parameter

T6

The type of the sixth parameter

T7

The type of the seventh parameter

Inheritance
NamedScript<T1, T2, T3, T4, T5, T6, T7>
Implements
Inherited Members

Remarks

Whilst the generic type parameters of this type have no direct bearing upon its members (such as properties), they are very useful when combined with the many overloads of the builder method ExecuteAScript in the PerformableBuilder class.

Developers are encouraged to store JavaScripts in their apps/tests as instances of this type and other related types (see the "See Also" section). This improves the reusability of the script, improves its presence in Screenplay reports and provides type safety. For more information, see the named scripts article.

For scripts which are created in this manner, getting an IPerformable or IPerformableWithResult<TResult> for those scripts is very easy and type safe. Use the ExecuteAScript method from the PerformableBuilder and the compiler will use generic type inference to select an appropriate overload. The parameters and return type will then be type-safe and of the appropriate number.

Another benefit is that scripts defined and stored in instances of this type are reusable and easily catalogued. See the Scripts helper class for an example of a catalogue of script objects which may be executed. Once again, developers are encouraged to follow this pattern in their own applications/tests which use Screenplay & Selenium.

Constructors

NamedScript(string, string)

Initialises a new instance of NamedScript.

public NamedScript(string scriptBody, string name)

Parameters

scriptBody string

The body of the JavaScript

name string

The human-readable name of the script

Exceptions

ArgumentException

If either parameter is null or whitespace-only.

See Also

NamedScript
NamedScript<T1>
NamedScript<T1, T2>
NamedScript<T1, T2, T3>
NamedScript<T1, T2, T3, T4>
NamedScript<T1, T2, T3, T4, T5>
NamedScript<T1, T2, T3, T4, T5, T6>
NamedScriptWithResult<TResult>
NamedScriptWithResult<T1, TResult>
NamedScriptWithResult<T1, T2, TResult>
NamedScriptWithResult<T1, T2, T3, TResult>
NamedScriptWithResult<T1, T2, T3, T4, TResult>
NamedScriptWithResult<T1, T2, T3, T4, T5, TResult>
NamedScriptWithResult<T1, T2, T3, T4, T5, T6, TResult>
NamedScriptWithResult<T1, T2, T3, T4, T5, T6, T7, TResult>