0

Coded UI Editor 能够在.Net 3.5 AnyCPU应用程序中找到控件

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

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

Unable to locate the selected UI control  

测试日志中的错误

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.... 任何帮助将不胜感激。

4

1 回答 1

0

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

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

于 2013-11-20T05:22:34.453 回答