WebEngineOptions
Namespace: E2E.Engine
public sealed class WebEngineOptionsOptions of the browser engine: how it drives the app.
Inheritance: object
Properties
Section titled “Properties”BasicAuth
Section titled “BasicAuth”public WebBasicAuth? BasicAuth { get; init; }Basic-auth credentials the browser answers a challenge with, wherever one is issued.
Value: WebBasicAuth
Browser
Section titled “Browser”public IBrowserProvider? Browser { get; init; }Leases hosted browsers from a provider instead of launching one: the engine attaches over CDP the way Connect does, and adds the lifecycle Connect lacks. It asks the provider for a browser when one is needed and gives it back when its scope ends, on every exit path. A provider implies Chromium and cannot be combined with Connect. With Attempt scope the attempt rides a persistent context, with the limits of ReconnectEndpoint.
Value: IBrowserProvider
ColorScheme
Section titled “ColorScheme”public WebColorScheme? ColorScheme { get; init; }The prefers-color-scheme every page reports from its first paint, to its @media rules and
to matchMedia, as Playwright’s own colorScheme context option sets it. Defaults to the
browser’s own. Browser.EmulateMediaAsync changes it for the rest of one attempt.
Value: WebColorScheme?
Connect
Section titled “Connect”public WebConnectOptions? Connect { get; init; }Attach to a remote Chromium over CDP instead of launching a local one.
Value: WebConnectOptions
Headers
Section titled “Headers”public IReadOnlyDictionary<string, string>? Headers { get; init; }Headers added to every request bound for the app’s host (the host of the session’s base URL). Requests to any other host never carry them, so a secret header stays with the app it unlocks. Names are case-insensitive and replace a header the page already sends under the same name. Routing every request turns the browser’s HTTP cache off.
Value: IReadOnlyDictionary<string, string>
Headless
Section titled “Headless”public bool? Headless { get; init; }Runs Chromium without a window. When unset, E2E_HEADLESS=0 or false shows the window; headless otherwise.
Value: bool?
InitScripts
Section titled “InitScripts”public IReadOnlyList<WebInitScript>? InitScripts { get; init; }Scripts every document runs before the page’s own, in every tab and frame, in order.
Value: IReadOnlyList<WebInitScript>
Locale
Section titled “Locale”public string? Locale { get; init; }The locale every attempt’s context runs in, a BCP 47 tag such as de-DE:
what navigator.language, Intl formatting, and the Accept-Language
header report. Defaults to the browser’s own. An accept-language entry in
Headers beside it is INVALID_CONFIG.
Value: string
ReducedMotion
Section titled “ReducedMotion”public WebReducedMotion? ReducedMotion { get; init; }The prefers-reduced-motion every page reports from its first paint, as Playwright’s own
reducedMotion context option sets it: Reduce lets an app’s own rule
turn its animations off, so none races an assertion. Defaults to the browser’s own.
Browser.EmulateMediaAsync changes it for the rest of one attempt.
Value: WebReducedMotion?
Screencast
Section titled “Screencast”public WebScreencastOptions? Screencast { get; init; }How the engine’s own screencast records an attempt that records video, when the browser provider does not record
it. Which attempts record is the config’s video.
Value: WebScreencastOptions
TestIdAttribute
Section titled “TestIdAttribute”public string TestIdAttribute { get; init; }The attribute that carries an element’s test id: what GetByTestId resolves and TestId reports.
Value: string
TimezoneId
Section titled “TimezoneId”public string? TimezoneId { get; init; }The IANA time zone every attempt’s context runs in, such as Europe/Berlin:
what Date and Intl resolve local time against. Defaults to the machine’s.
Value: string
UserAgent
Section titled “UserAgent”public string? UserAgent { get; init; }The User-Agent the browser sends and navigator.userAgent reports. Defaults to the browser’s own.
Value: string
Viewport
Section titled “Viewport”public WebViewport? Viewport { get; init; }Initial viewport of every attempt’s page; default 1280 by 720. <a href=“https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> emulates no size: the page fills the browser window, whatever size it has.
Value: WebViewport