Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 编码UI-断言无法检测专有WPF控件_C#_Wpf_Mstest_Coded Ui Tests - Fatal编程技术网

C# 编码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=

我在编码的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="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;