Plugin.Maui.UITestHelpers.Repl 1.0.0

dotnet add package Plugin.Maui.UITestHelpers.Repl --version 1.0.0
                    
NuGet\Install-Package Plugin.Maui.UITestHelpers.Repl -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Maui.UITestHelpers.Repl" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Maui.UITestHelpers.Repl" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Maui.UITestHelpers.Repl" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Plugin.Maui.UITestHelpers.Repl --version 1.0.0
                    
#r "nuget: Plugin.Maui.UITestHelpers.Repl, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Plugin.Maui.UITestHelpers.Repl@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Plugin.Maui.UITestHelpers.Repl&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Maui.UITestHelpers.Repl&version=1.0.0
                    
Install as a Cake Tool

alternate text is missing from this package README image

Plugin.Maui.UITestHelpers

Plugin.Maui.UITestHelpers provides a set of helpers to support UI testing your .NET MAUI app with Appium and migration from Xamarin.UITest to Appium. It consists of three packages, see below for more information.

The set of helpers are extracted from the .NET MAUI codebase (here, the folders prefixed UITest) this code can help with writing UI tests with Appium and/or transition your existing Xamarin.UITest tests to Appium.

At this time this project is not officially supported and experimental. Feel free to let us know your feedback and provide pull requests to make it even better. There is no guarantee this will become something more official.

<sub>But if you like what you see and help make it better... It might! </sub>

Install Plugin

This project consists of four packages. please find the details below. All packages are available on NuGet.

Package Name Description NuGet Package
Plugin.Maui.UITestHelpers.Core Shared, core types that are used across the different projects NuGet Version
Plugin.Maui.UITestHelpers.Appium This package contains code specific to UI testing with Appium. It's filled with helpers that will make writing UI tests easier, as well as methods that (mostly) mimic Xamarin.UITest to make transitioning your current UI tests easier NuGet Version
Plugin.Maui.UITestHelpers.NUnit This package contains helpers that will make it easier to write UI tests based on NUnit NuGet Version
Plugin.Maui.UITestHelpers.Repl An interactive REPL for your UI tests, like the one in Xamarin.UITest. Explore your running app and try out test code live NuGet Version

Install with the dotnet CLI, for example: dotnet add package Plugin.Maui.UITestHelpers.Appium, or through the NuGet Package Manager in Visual Studio.

Supported Platforms

All platforms that are supported by the cross section of the support of Appium and .NET MAUI.

On Android, app data is preserved by default when AppId is set. Set FullReset to true and provide an AppPath to reinstall the app when the Appium session starts. Do not enable NoReset and FullReset together.

FullReset applies when an Appium session starts, not before each test. UITestBase reuses one session across tests and only starts a new one when Reset() is called, for example after a crash. To start every test from a freshly launched app, add a [SetUp] method to your test class that derives from UITestBase:

using NUnit.Framework;
using Plugin.Maui.UITestHelpers.Appium;

[SetUp]
public void RestartApp() => App.ResetApp();

ResetApp() closes and relaunches the app, but keeps its data. Leave the app running at the end of a test: if the app is closed when the test finishes, UITestBase treats it as a crash and fails the test.

REPL

Call App.Repl() from a test to pause it and open an interactive prompt that is connected to your running app. Anything you type is C#, with app being the app, so you can try app.Tap("CounterBtn") or look at the screen with tree, and copy what worked into your test. It works on every platform Appium does.

using Plugin.Maui.UITestHelpers.Core;

[Test, Explicit]
public void ExploreTheApp()
{
    App.WaitForElement("CounterBtn");
    App.Repl(); // continues when you type 'exit'
}

Install Plugin.Maui.UITestHelpers.Repl to use it. See the REPL guide for everything it can do.

While debugging, call App.Repl() from code (or step over that line) rather than from Visual Studio's Immediate Window, where the debugger freezes the threads the REPL needs. See While debugging.

Passing other Appium capabilities

To set an Appium capability that doesn't have its own config property, add it to the AdditionalCapabilities dictionary in your test config:

config.SetProperty("AdditionalCapabilities", new Dictionary<string, object>
{
    ["systemPort"] = 8201,
    ["disableWindowAnimation"] = true,
});

Names without a vendor prefix get the appium: prefix. These capabilities are applied last, so they also override values the library sets itself, such as newCommandTimeout. For capabilities that have their own config property, such as AppId (appPackage/bundleId), use that property: the library also relies on it after the session has started. Standard W3C capabilities (like platformName), automationName (set by the library for each platform) and app, deviceName and platformVersion (use AppPath, DeviceName and PlatformVersion) can't be set this way. See the driver documentation for the available capabilities, for example the UiAutomator2 capabilities.

Testing webview content

On Android and iOS you can interact with the content of a WebView (or a Blazor Hybrid BlazorWebView) by switching to its webview context:

App.SwitchContextToWebview();
App.TapWebviewButtonByText("Sign in");
App.ScrollWebview(down: true);
App.SwitchContextToNative();

For Appium to find the webview, your app has to make it debuggable: on Android call Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true), on iOS 16.4 and later set Inspectable = true on the WKWebView (see the sample's MauiProgram.cs). Only do this in builds you test, not in production builds. On Android, Appium also needs a Chromedriver that matches the WebView version on the device, for example by starting Appium with --allow-insecure uiautomator2:chromedriver_autodownload.

To make it easier to add UI test projects to your existing solution, I also have a template that you can use: https://github.com/jfversluis/Template.Maui.UITesting/

Additionally, please find some blog posts and samples that we have made available to get you started:

Acknowledgements

This project could not have came to be without these projects and people, thank you! ❤️

The original source was extracted from the .NET MAUI codebase so all credit goes out to that team, namely @sbanni, @mattleibow, @PureWeen, @MartyIX, @jsuarezruiz, @jfversluis and @rmarinho.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0 52 11/25/2026