C# 编码UI-断言无法检测专有WPF控件
我在编码的UI测试中遇到了一个问题,断言机制无法检测专有WPF控件的类型,并将其检测为自定义,即使它不是。例如,我有以下结构:C# 编码UI-断言无法检测专有WPF控件,c#,wpf,mstest,coded-ui-tests,C#,Wpf,Mstest,Coded Ui Tests,我在编码的UI测试中遇到了一个问题,断言机制无法检测专有WPF控件的类型,并将其检测为自定义,即使它不是。例如,我有以下结构: <Window> <Grid> <Label x:Name="label1" Content="MyLabel" HorizontalAlignment="Left" Height="56" Margin="233.933,41,0,0" VerticalAlignment="Top" Width="106" Grid.Column=
<Window>
<Grid>
<Label x:Name="label1" Content="MyLabel" HorizontalAlignment="Left" Height="56" Margin="233.933,41,0,0" VerticalAlignment="Top" Width="106" Grid.Column="1"/>
我一定是做错了什么。我正在考虑为它们编写一个自定义处理程序,但这不是首选的方法,因为对于录制本身,所有控件都正确地映射到WPF控件。我目前正在VM Win7上使用Enterprise VS2017。有什么想法吗?MyLabel是从CustomLabel中派生出来的吗?没有,定义如下:[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(“Microsoft.Performance”,“CA1823:AvoidUnusedPrivateFields”)]internal System.Windows.Controls.label1;你解决了吗?不幸的是没有。因此,似乎我将使用断言的自定义处理程序来解决这个问题
WpfCustom uILabelCustom = this.UIMyFancyTestAppMicrosWindow.UIItemTabList.UIMainWindowxamlTabPage1.UIMainWindowxamlPane.UIItemPane.UIItemWindow.UISplitViewContainerClient.UIMainWindowxamlWindow.UIItemPane.UIItemPane1.UIItemWindow.UIItemPane.UIRemoteUIElementHoldeWindow.UIRemoteContentHolderPane.UIWindowCustom.UIGridCustom.UILabelCustom;