Skip to content

WebInitScript

Namespace: E2E.Engine

public sealed class WebInitScript

A script every document runs before the page’s own, in every tab and frame: JavaScript source, a file of it, or a function source the page calls. A string converts to source.

Inheritance: object

View source

public string? Function { get; }

The source of a function the page calls, such as () => { ... }, or <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a> for source or a file. It cannot close over test variables; Browser.AddInitScriptAsync passes it one JSON argument.

Value: string

View source

public string? Path { get; }

The file of JavaScript source, relative to the project root, or <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a> for source or a function.

Value: string

View source

public string? Source { get; }

The JavaScript source, or <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null"&gt;null&lt;/a> for a file or a function.

Value: string

View source

public static WebInitScript FromFunction(string function)

Parameters

Name Type Description
function string

Returns: WebInitScript

View source

public static WebInitScript FromPath(string path)

Parameters

Name Type Description
path string

Returns: WebInitScript

View source

public static WebInitScript FromSource(string source)

Parameters

Name Type Description
source string

Returns: WebInitScript

View source

public static implicit operator WebInitScript(string source)

Parameters

Name Type Description
source string

Returns: WebInitScript

View source