Provides element location strategies similar to Appium/Selenium WebDriver. Use these methods to create locator strategies for finding UI elements.
public class By
kind:method, kind:property, kind:ctor. Press Esc to clear.OptionsGets additional options for the locator.StrategyGets the locator strategy type.ValueGets the locator value.AccessibilityLabel(String)Locates elements by accessibility label.AccessibilityName(String)Locates elements by accessibility name. Maps to AutomationProperties.Name in Avalonia.All(By[])Combines multiple locators with AND logic.Any(By[])Combines multiple locators with OR logic.AutomationId(String)Locates an element by its AutomationId (for accessibility). Maps to AutomationProperties.AutomationId in Avalonia.Chained(By[])Creates a chained locator for finding nested elements.ClassName(String)Locates elements by their class name (type name).ContainsText(String)Locates elements containing the specified text.CssClass(String)Locates elements by a CSS-like class selector. Maps to StyleClass/Classes in Avalonia.CssSelector(String)Locates elements by a CSS selector. In Avalonia context, this maps to StyleClass/Classes matching. This is the standard Selenium-compatible method name.Focused()Locates the currently focused element.FullClassName(String)Locates elements by their full type name including namespace.Id(String)Locates an element by its unique ID (Name property in Avalonia).LinkText(String)Locates elements by their link text (for hyperlinks/buttons). This is the standard Selenium locator - maps to Text matching in Avalonia.Name(String)Locates an element by its Name property. Alias for Id() in Avalonia context.NameRegex(String)Locates elements by regex pattern on their Name.PartialLinkText(String)Locates elements by partial link text (for hyperlinks/buttons). This is the standard Selenium locator - maps to partial Text matching in Avalonia.Predicate(String, String)Locates elements using a custom predicate.Property(String, Object?)Locates elements by Avalonia property value.TagName(String)Locates elements by a tag name (simplified type name).Text(String, Boolean)Locates elements by their text content. Searches in common text properties like Text, Content, Header.ToString()Returns a string representation of this locator.Type(Type)Locates elements by their type.Type<T>()Locates elements by their type.XPath(String)Locates elements using XPath-like expressions. Supports custom XPath syntax for Avalonia visual trees.