Main driver class for Avalonia headless testing with Appium-like API. Provides WebDriver/Appium compatible methods for UI automation.
public class AvaloniaDriver : IDisposable
using var driver = new AvaloniaDriver(window);
// Find and interact with elements
var button = driver.FindElement(By.Id("submitBtn"));
button.Click();
// Use XPath-like queries
var textBox = driver.FindElement(By.XPath("//TextBox[@Name='username']"));
textBox.SendKeys("testuser");
// Wait for conditions
driver.Wait.Until(d => d.FindElement(By.Id("result")).Displayed);
kind:method, kind:property, kind:ctor. Press Esc to clear.AvaloniaDriver(Control)Creates a new AvaloniaDriver for the specified control.AvaloniaDriver(Window)Creates a new AvaloniaDriver for the specified window.ActiveElementGets the active/focused element.GestureSimulatorGets the gesture simulator.ImplicitWaitGets or sets the implicit wait timeout.KeyboardSimulatorGets the keyboard input simulator.MouseSimulatorGets the mouse input simulator.PageSourceGets the current page source (visual tree XML representation).RootGets the root control being automated.TitleGets the title of the window if root is a Window.TouchSimulatorGets the touch input simulator.WaitGets the wait helper for explicit waits.Back()Navigates back (if using Frame navigation).Click(Double, Double)Clicks at the specified position.Close()Closes the window.CreateTouchAction()Creates a new touch action chain.Dispose()Disposes the driver resources.ElementCount(By)Gets the count of elements matching the locator.ElementExists(By)Checks if an element exists.ExecuteScript<TViewModel>(Action<TViewModel>)Executes an action on the DataContext.ExecuteScript<TViewModel, TResult>(Func<TViewModel, TResult>)Gets a value from the DataContext.FindElement(By)Finds an element matching the locator.FindElements(By)Finds all elements matching the locator.Forward()Navigates forward (if using Frame navigation).FromApplication()Creates a driver from the current application's main window.Fullscreen()Makes the window fullscreen.GetWindowPosition()Gets the window position.GetWindowSize()Gets the window size.Maximize()Maximizes the window.Minimize()Minimizes the window.NavigateTo(Type)Navigates to a view by setting window content (for single-page apps). Uses SetCurrentValue to preserve any bindings on the Content property.NavigateTo<T>()Navigates to a view by setting window content. Uses SetCurrentValue to preserve any bindings on the Content property.PressKey(Key, KeyModifiers)Presses a key.Refresh()Refreshes the current view.RegisterPredicate(String, Func<Control, Boolean>)Registers a custom predicate for use with By.Predicate.Restore()Restores the window to normal state.SaveScreenshot(String)Saves a screenshot to a file.Screenshot()Takes a screenshot of the entire root control.ScreenshotAsBase64()Takes a screenshot and returns it as Base64.SendKeys(String)Sends keys to the focused element.SetWindowPosition(Int32, Int32)Moves the window.SetWindowSize(Double, Double)Resizes the window.Tap(Double, Double)Taps at the specified position (touch).TryFindElement(By)Tries to find an element, returning null if not found.