WebViewDriver.Host
0.3.0
dotnet add package WebViewDriver.Host --version 0.3.0
NuGet\Install-Package WebViewDriver.Host -Version 0.3.0
<PackageReference Include="WebViewDriver.Host" Version="0.3.0" />
<PackageVersion Include="WebViewDriver.Host" Version="0.3.0" />
<PackageReference Include="WebViewDriver.Host" />
paket add WebViewDriver.Host --version 0.3.0
#r "nuget: WebViewDriver.Host, 0.3.0"
#:package WebViewDriver.Host@0.3.0
#addin nuget:?package=WebViewDriver.Host&version=0.3.0
#tool nuget:?package=WebViewDriver.Host&version=0.3.0
WebViewDriver.Host
This is the app-side package for WebViewDriver. It exposes an embedded webview to tests through a local JavaScript evaluation endpoint.
Install this package in the app under test. Install
WebViewDriver.Selenium in the test project.
Setup
Register the host and attach the webview after its platform view is created:
using Microsoft.Maui.Handlers;
using WebViewDriver.Host;
#if DEBUG
WebViewDriverHost.TryStartFromEnvironment();
HybridWebViewHandler.Mapper.AppendToMapping("WebViewDriver", (handler, _) =>
{
#if MACCATALYST || IOS
WebViewDriverHost.Attach(
"main",
(WebKit.WKWebView)handler.PlatformView);
#endif
});
#endif
Custom webview wrappers can provide an evaluation delegate:
WebViewDriverHost.Attach(
"main",
script => myWebView.EvaluateJavaScriptAsync(script));
The test launcher must set both environment variables:
WEBVIEWDRIVER_PORT=17321
WEBVIEWDRIVER_TOKEN=<random per-run token>
The host remains inactive when either value is missing.
Readiness
An app can prevent clients from connecting before startup is complete:
WebViewDriverHost.SetReady("main", false);
// Finish application startup.
WebViewDriverHost.SetReady("main", true);
Security
This package provides JavaScript evaluation inside the app. Include and register it only in Debug or QA builds.
- The endpoint listens on
127.0.0.1only. - Every request requires the session token.
- Requests are size-limited.
- Evaluations are serialized per webview.
- No shell, file-system, or reflection API is exposed.
See the project documentation for the complete setup and supported commands.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 is compatible. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net10.0-ios26.0
- No dependencies.
-
net10.0-maccatalyst26.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.0 | 103 | 9/18/2026 |
Initial 0.3 release.