TestPageSettings Class

The settings of the browsing context of a TestPage.

public sealed class TestPageSettings

Constructors

NameDescription
TestPageSettings()

TestPageSettings()

TestPageSettings.cs
public TestPageSettings()

No documentation is available.

Properties

NameDescription
ConfigureBrowsingContextGets a function that changes the options of the browsing context of the page, or null. It receives the options made from the other settings and returns the options to use, usually with a with expression: options => options with { UserAgent = "..." }. The page still records the console messages, the script errors and the content security policy violations, and calls the callbacks that the function sets. The function cannot replace BrowsingContextOptions.DocumentLoader nor BrowsingContextOptions.ScriptEngine: the page waits for the requests of its loader and calls the functions of its engine, so set TestPageSettings.DocumentLoader and TestPageSettings.ScriptEngine instead.
CookieJarGets the cookies of the page, or null for no cookie. Pages that share a jar share their cookies.
DefaultTimeoutGets the maximum time the waits of the page wait for. The default is 10 seconds.
DocumentLoaderGets the loader of the documents and of their resources, or null to fetch nothing.
ScriptEngineGets the engine that runs the scripts of the page, or null to run no script. The page disposes it.
TestIdAttributeGets the name of the attribute that LocatorScope.GetByTestId matches. The default is data-testid.
TimeProviderGets the clock of the timers of the page (setTimeout(), the animations...), or null for the system clock.
ViewportGets the size of the viewport, in CSS pixels. The default is 1280x720.

ConfigureBrowsingContext

TestPageSettings.cs

Gets a function that changes the options of the browsing context of the page, or null. It receives the options made from the other settings and returns the options to use, usually with a with expression: options => options with { UserAgent = "..." }. The page still records the console messages, the script errors and the content security policy violations, and calls the callbacks that the function sets. The function cannot replace BrowsingContextOptions.DocumentLoader nor BrowsingContextOptions.ScriptEngine: the page waits for the requests of its loader and calls the functions of its engine, so set TestPageSettings.DocumentLoader and TestPageSettings.ScriptEngine instead.

public Func<BrowsingContextOptions, BrowsingContextOptions>? ConfigureBrowsingContext { get; init; }

Property value

Func<BrowsingContextOptions, BrowsingContextOptions>?

Remarks

The page throws an InvalidOperationException when the function replaces them.

Gets the cookies of the page, or null for no cookie. Pages that share a jar share their cookies.

public CookieJar? CookieJar { get; init; }

Property value

CookieJar?

DefaultTimeout

TestPageSettings.cs

Gets the maximum time the waits of the page wait for. The default is 10 seconds.

public TimeSpan DefaultTimeout { get; init; }

Property value

TimeSpan

DocumentLoader

TestPageSettings.cs

Gets the loader of the documents and of their resources, or null to fetch nothing.

public DocumentLoader? DocumentLoader { get; init; }

Property value

DocumentLoader?

Gets the engine that runs the scripts of the page, or null to run no script. The page disposes it.

public ScriptEngine? ScriptEngine { get; init; }

Property value

ScriptEngine?

TestIdAttribute

TestPageSettings.cs

Gets the name of the attribute that LocatorScope.GetByTestId matches. The default is data-testid.

public string TestIdAttribute { get; init; }

Property value

string

Gets the clock of the timers of the page (setTimeout(), the animations...), or null for the system clock.

public TimeProvider? TimeProvider { get; init; }

Property value

TimeProvider?

Gets the size of the viewport, in CSS pixels. The default is 1280x720.

public ViewportOptions Viewport { get; init; }

Property value

ViewportOptions