Table of Contents

Class ExecuteJavaScriptBuilderWithResult<TResult>

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

A builder type for executing JavaScript in the browser, where the script is expected to return a result value.

public class ExecuteJavaScriptBuilderWithResult<TResult> : ExecuteJavaScriptBuilderBase, IGetsPerformableWithResult<TResult>

Type Parameters

TResult
Inheritance
ExecuteJavaScriptBuilderWithResult<TResult>
Implements
Inherited Members

Constructors

ExecuteJavaScriptBuilderWithResult(string)

Initialises a new instance of ExecuteJavaScriptBuilderWithResult<TResult>.

public ExecuteJavaScriptBuilderWithResult(string scriptBody)

Parameters

scriptBody string

The body of the JavaScript to be executed.

Exceptions

ArgumentException

If scriptBody is null or a whitepace-only string

Methods

WithTheArguments(params object[])

Sets the arguments (parameters) for the script.

public ExecuteJavaScriptBuilderWithResult<TResult> WithTheArguments(params object[] arguments)

Parameters

arguments object[]

A collection of parameter values

Returns

ExecuteJavaScriptBuilderWithResult<TResult>

This same builder object, so calls may be chained

Remarks

This method is optional; if the script requires no parameters then it is unneccesary to use this method.

Exceptions

InvalidOperationException

If the arguments have already been set

WithTheName(string)

Sets a human-readable name for the script, which may be displayed in Screenplay reports.

public ExecuteJavaScriptBuilderWithResult<TResult> WithTheName(string name)

Parameters

name string

The human-readable name for the script

Returns

ExecuteJavaScriptBuilderWithResult<TResult>

This same builder object, so calls may be chained

Exceptions

ArgumentException

If the name is null or a whitepace-only string

InvalidOperationException

If the name has already been set