Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.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自动化-使用编码UI的对象识别问题_C#_.net_Wpf_Ui Automation_Coded Ui Tests - Fatal编程技术网

C# UI自动化-使用编码UI的对象识别问题

C# UI自动化-使用编码UI的对象识别问题,c#,.net,wpf,ui-automation,coded-ui-tests,C#,.net,Wpf,Ui Automation,Coded Ui Tests,我正在使用VisualStudio编码的UI实现WPF应用程序的UI自动化 我已经使用记录功能生成了脚本,所有必需的对象都添加到设计器文件中。 但当我播放我的脚本时,一些时候正在测试的应用程序的对象被识别,但有时对象没有被识别。编码的UI无法识别和播放脚本 有谁能建议一种方法,以便每次运行脚本时都能识别对象。我认为,通过给WPF控件提供自动化ID,这应该在您正在测试的应用程序中完成,并且在编码的UI中使用此自动化ID应该能够每次识别元素。我知道这是一个非常漫长的过程,但这将确保每次都能识别元素。

我正在使用VisualStudio编码的UI实现WPF应用程序的UI自动化

我已经使用记录功能生成了脚本,所有必需的对象都添加到设计器文件中。 但当我播放我的脚本时,一些时候正在测试的应用程序的对象被识别,但有时对象没有被识别。编码的UI无法识别和播放脚本


有谁能建议一种方法,以便每次运行脚本时都能识别对象。

我认为,通过给WPF控件提供自动化ID,这应该在您正在测试的应用程序中完成,并且在编码的UI中使用此自动化ID应该能够每次识别元素。我知道这是一个非常漫长的过程,但这将确保每次都能识别元素。嗨,用户,我们记录的所有对象都会自动生成自动化id。那么,你能告诉我你在上面讨论的让对象每次都能识别的冗长过程是什么吗?冗长的过程是给有意义的AutomationID而不是自动生成的,因为依赖显式名称比自动生成名称更好。如果已经开发了应用程序,则需要为每个控件执行该应用程序。