TestPageSettings Class
The settings of the browsing context of a TestPage.
public sealed class TestPageSettingsConstructors
| Name | Description |
|---|---|
| TestPageSettings() |
TestPageSettings()
TestPageSettings.cspublic TestPageSettings()No documentation is available.
Properties
| Name | Description |
|---|---|
| ConfigureBrowsingContext | 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. |
| CookieJar | Gets the cookies of the page, or null for no cookie. Pages that share a jar share their cookies. |
| DefaultTimeout | Gets the maximum time the waits of the page wait for. The default is 10 seconds. |
| DocumentLoader | Gets the loader of the documents and of their resources, or null to fetch nothing. |
| ScriptEngine | Gets the engine that runs the scripts of the page, or null to run no script. The page disposes it. |
| TestIdAttribute | Gets the name of the attribute that LocatorScope.GetByTestId matches. The default is data-testid. |
| TimeProvider | Gets the clock of the timers of the page (setTimeout(), the animations...), or null for the system clock. |
| Viewport | Gets the size of the viewport, in CSS pixels. The default is 1280x720. |
ConfigureBrowsingContext
TestPageSettings.csGets 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.
CookieJar
TestPageSettings.csGets 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
DefaultTimeout
TestPageSettings.csDocumentLoader
TestPageSettings.csGets the loader of the documents and of their resources, or null to fetch nothing.
public DocumentLoader? DocumentLoader { get; init; }Property value
ScriptEngine
TestPageSettings.csGets 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
TestIdAttribute
TestPageSettings.csGets the name of the attribute that LocatorScope.GetByTestId matches. The default is data-testid.
public string TestIdAttribute { get; init; }Property value
TimeProvider
TestPageSettings.csGets the clock of the timers of the page (setTimeout(), the animations...), or null for the system clock.
public TimeProvider? TimeProvider { get; init; }Property value
Viewport
TestPageSettings.csGets the size of the viewport, in CSS pixels. The default is 1280x720.
public ViewportOptions Viewport { get; init; }