When a locator is constructed, the attribute type is automatically assigned based on the technology domain that your application uses. The attribute type and value determines how the locator identifies objects within your tests.
Silk Test Classic supports the following locator attributes for WPF controls:
To identify components within WPF scripts, you can specify the automationId, caption, className, or name. The name that is given to an element in the application is used as the automationId attribute for the locator if available. As a result, most objects can be uniquely identified using only this attribute. For example, a locator with an automationId might look like: //WPFButton[@automationId='okButton']".
If you define an automationId and any other attribute, only the automationId is used during replay. If there is no automationId defined, the name is used to resolve the component. If neither a name nor an automationId are defined, the caption value is used. If no caption is defined, the className is used. We recommend using the automationId because it is the most useful property.
An ID that was provided by the developer of the test application.
|The name of a control. The Visual Studio designer automatically assigns a name to every control that is created with the designer. The application developer uses this name to identify the control in the application code.
The text that the control displays. When testing a localized application in multiple languages, use the automationId or name attribute instead of the caption.
The simple .NET class name (without namespace) of the WPF control. Using the class name attribute can help to identify a custom control that is derived from a standard WPF control that Silk Test Classic recognizes.
During recording, Silk Test Classic creates a locator for a WPF control by using the automationId, name, caption, or className attributes in the order that they are listed in the preceding table. For example, if a control has a automationId and a name, Silk Test Classic uses the automationId when creating the locator.
<Button Name="okButton" AutomationProperties.AutomationId="okButton" Click="okButton_Click">Ok</Button>