Dynamic Locator Attributes

In a locator for identifying a control during replay you can use a pre-defined set of locator attributes, for example caption and automationId, which depend on the technology domain. But you can also use every property, including dynamic properties, of a control as locator attribute. A list of available properties for a certain control can be retrieved with the GetPropertyList method. All returned properties can be used for identifying a control with a locator.

Note: You can use the GetProperty method to retrieve the actual value for a certain property of interest. You can then use this value in your locator.


If you want to identify the button that has the user input focus in a Silverlight application, you can type:
or alternatively
Dim button = dialog.SLButton("@IsKeyboardFocused=true")
This works because Silk Test Workbench exposes a property called IsDefault for the Silverlight button control.


If you want to identify a button in a Silverlight application with the font size 12 you can type:
Dim button = browser.Find("//SLButton[@FontSize=12]")
or alternatively
Dim button = browser.SLButton("@FontSize=12")
This works because the underlying control in the application under test, in this case the Silverlight button, has a property called FontSize.