WPF applications use the predefined automation property
AutomationProperties.AutomationId to specify a stable identifier for the WPF control as follows:
<Window x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button AutomationProperties.AutomationId="AID_buttonA">The
Button</Button>
</Grid>
</Window>
Silk4NET automatically uses this property for identification in the locator. WPF application locators look like the following:
/WPFWindow[@caption='MainWindow']//WPFButton[@automationId='AID_buttonA']