withBrowserLogs
Method
interface ContainerResource { // ... omitted for brevity withBrowserLogs( browser?: string, profile?: string, userDataMode?: BrowserUserDataMode): IResourceWithEndpoints;}Signature
method
withBrowserLogs builderAdds a child resource that can open the application's primary browser endpoint in a tracked browser session, surface browser diagnostics, and capture screenshots.
withBrowserLogs( browser?: string, profile?: string, userDataMode?: BrowserUserDataMode): IResourceWithEndpointsParameters
browserstringoptionalThe browser to launch. When not specified, the tracked browser uses the configured value from `Aspire:Hosting:BrowserLogs` and otherwise prefers an installed `"msedge"` browser in shared user data mode, an installed `"chrome"` browser in isolated user data mode, and finally falls back to `"chrome"`. Supported values include logical browser names such as `"msedge"` and `"chrome"`, or an explicit browser executable path.profilestringoptionalOptional Chromium profile name or directory name to use. Only valid when the effective user data mode is `Shared`. When not specified, the tracked browser uses the configured value from `Aspire:Hosting:BrowserLogs` if present.userDataMode BrowserUserDataMode optionalOptional `BrowserUserDataMode` that selects whether the tracked browser launches against a persistent Aspire-managed user data directory shared across all AppHosts on the machine (`Shared`, the default) or a per-AppHost persistent user data directory (`Isolated`). Both modes use Aspire-managed paths under `%LocalAppData%\Aspire\BrowserData` on Windows (or platform equivalents); the user's normal browser profile is never used. When not specified, the tracked browser uses the configured value from `Aspire:Hosting:BrowserLogs` and otherwise defaults to `Shared`.Returns
IResourceWithEndpoints Applies to
This method applies to the following types: