编码的UI无法正确找到.Net 4.0 64位应用程序中的Control

时间:2013-03-05 10:40:30

标签: wpf .net-4.0 64-bit coded-ui-tests

编码的UI编辑器能够在.Net 3.5 AnyCPU应用程序

中找到控件

但是此应用已转移到.Net 4.0并定位到64 bit Platform

现在应用程序第一次找到控件,当我们按下刷新按钮时,编辑器(Coded UI Test Builder Popup)说

Unable to locate the selected UI control  

TestLog中的错误

W, 6404, 5, 2013/03/05, 15:58:51.140, 19627190016, CodedUITestBuilder.exe, Playback - [WARNING] Internal warning:Search failure: <[UIA]ControlType='TabList' && AutomationId='ADCTRL_TabControl'> | Performed (4) search retries, UI element not found 
V, 6404, 5, 2013/03/05, 15:58:51.141, 19627190318, CodedUITestBuilder.exe, Playback - 3.5.2013 @15:58:51 
E, 6404, 5, 2013/03/05, 15:58:51.141, 19627190475, CodedUITestBuilder.exe, Playback - {1} [FAILED] Function ElementFetcher::FindScreenElement failed to locate UI element (Searching: ;[UIA]ControlType='TabList' && AutomationId='ADCTRL_TabControl';[UIA]ControlType='TabPage' && AutomationId='TABITEM_GameSettings';[UIA]ControlType='Button' && AutomationId='SelectableText') (The object specified was not found.) 
E, 6404, 5, 2013/03/05, 15:58:51.281, 19627573969, CodedUITestBuilder.exe, Playback - [IMAGE] C:\Users\AD\AppData\Local\Temp\UITestLogs\CodedUITestBuilder\LastRun\RPFCBBB.png 
W, 6404, 5, 2013/03/05, 15:58:51.281, 19627574279, CodedUITestBuilder.exe, Playback - [WARNING] Internal warning: Couldn't find descendants that match QueryId 
W, 6404, 5, 2013/03/05, 15:58:51.282, 19627575169, CodedUITestBuilder.exe, PERF WARNING: FindAllDescendents: took 4909 ms. Expected it to take maximum 500 ms.
V, 6404, 5, 2013/03/05, 15:58:51.293, 19627604746, CodedUITestBuilder.exe, AL: Setting search timeout to 120000 ms
V, 6404, 5, 2013/03/05, 15:58:51.293, 19627604912, CodedUITestBuilder.exe, PERF: AL : SearchHelper.Search: took 5067 ms.   

我完全糊涂了。我在.NET 3.5中担心但不是.Net 4.0 .... 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

IF编码的UI在使用控件执行操作之前,无法找到控件尝试发送焦点。 这段代码适合我。

//在使用UINOButton控件之前将焦点设置到UINOButton this.UIWindow2.UINOWindow.UINOButton.SetFocus();