XPath(String) Method

Definition

Assembly HeadlessTestingFramework.dll

Locates elements using XPath-like expressions. Supports custom XPath syntax for Avalonia visual trees.

public static By XPath(string xpath)

Parameters

xpath
String

The XPath expression.

Returns

By
A By locator for XPath matching.

Examples

var element = driver.FindElement(By.XPath("//Button[@Name='submit']"));
var nested = driver.FindElement(By.XPath("//StackPanel/Button[1]"));