If you want to run coded UI tests or create action recordings for your Silverlight 4 application, you must have a unique automation property that identifies each control. For more information about how to set up your Silverlight application so that the controls are recognized, see How to: Set Up Your Silverlight Application for Testing. Static XAML Definition
To specify a unique automation property for a control that is defined in your XAML file, you can set the AutomationProperties.AutomationId or AutomationProperties.Name implicitly or explicitly, as shown in the following examples. Setting either of these values gives the control a unique automation property that can be used to identify the control when you create a coded UI test or action recording. Set the Property ImplicitlySet the AutomationProperties.AutomationId to ButtonX using the Name property in the XAML for the control.<Button Name="ButtonX" Height="31" HorizontalAlignment="Left" Margin="23,26,0,0" VerticalAlignment="Top" Width="140" Click="ButtonX_Click" /> Set the Property ExplicitlySet the AutomationProperties.AutomationId to ButtonX explicitly in the XAML for the control.<Button AutomationProperties.AutomationId=“ButtonX” Height="31" HorizontalAlignment="Left" Margin="23,26,0,0" VerticalAlignment="Top" Width="140" Click="ButtonX_Click" /> Read more: Vishnu's Blog
To specify a unique automation property for a control that is defined in your XAML file, you can set the AutomationProperties.AutomationId or AutomationProperties.Name implicitly or explicitly, as shown in the following examples. Setting either of these values gives the control a unique automation property that can be used to identify the control when you create a coded UI test or action recording. Set the Property ImplicitlySet the AutomationProperties.AutomationId to ButtonX using the Name property in the XAML for the control.<Button Name="ButtonX" Height="31" HorizontalAlignment="Left" Margin="23,26,0,0" VerticalAlignment="Top" Width="140" Click="ButtonX_Click" /> Set the Property ExplicitlySet the AutomationProperties.AutomationId to ButtonX explicitly in the XAML for the control.<Button AutomationProperties.AutomationId=“ButtonX” Height="31" HorizontalAlignment="Left" Margin="23,26,0,0" VerticalAlignment="Top" Width="140" Click="ButtonX_Click" /> Read more: Vishnu's Blog
0 comments:
Post a Comment