我在winforms中录制的编码UI测试中途收到以下错误
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException: The following element is no longer available: Name [], ControlType [Window], NativeControlType [window], ClassName [WindowsForms10.Window.8.app.0.2a125d8_r17_ad1], RuntimeId [197812] Additional Details:
我最初的想法是,它与我试图访问模态窗口中的控件(通过ShowDialog显示)有关,但是一个独立的项目证明我错了。我真的不知道如何解决这个问题。有点怀疑在错误消息中没有控件名称。
我在winforms中录制的编码UI测试中途收到以下错误
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException: The following element is no longer available: Name [], ControlType [Window], NativeControlType [window], ClassName [WindowsForms10.Window.8.app.0.2a125d8_r17_ad1], RuntimeId [197812] Additional Details:
我最初的想法是,它与我试图访问模态窗口中的控件(通过ShowDialog显示)有关,但是一个独立的项目证明我错了。我真的不知道如何解决这个问题。有点怀疑在错误消息中没有控件名称。
编辑:添加了日志记录,所以这里有更多细节。这可能与窗口是对话框的事实有关。
Type 'cipher' in 'tbxFedId' text box0:00.376
The following element is no longer available: Name [], ControlType [Window], NativeControlType [window], ClassName [WindowsForms10.Window.8.app.0.2a125d8_r17_ad1], RuntimeId [4260726] Additional Details: TechnologyName: 'MSAA' ControlType: 'Edit'
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException
at Microsoft.VisualStudio.TestTools.UITesting.Playback.AddUITestControlDescriptionToException(Exception exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String actionName, UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String actionName, Object parameterValue, UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyValue(String propertyName, Object propertyValue)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyPrivate(String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl+<>c__DisplayClass180_0.<SetProperty>b__0()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod(Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetProperty(String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinEdit.set_Text(String value)
at UI.Test.UIMap.RecordedMethod1()
in C:\Users\pg2\Documents\Visual Studio 2015\Projects\ADTrack\UI.Test\UIMap.Designer.cs:line 68
at UI.Test.CodedUITest1.CodedUITestMethod1()
in C:\Users\pg2\Documents\Visual Studio 2015\Projects\ADTrack\UI.Test\CodedUITest1.cs:line 31
The following element is no longer available: Name [], ControlType [Window], NativeControlType [window], ClassName [WindowsForms10.Window.8.app.0.2a125d8_r17_ad1], RuntimeId [4260726]
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException
at Microsoft.VisualStudio.TestTools.UITest.Framework.AbstractUITestService.MapAndThrowException(Exception ex, IUITechnologyElement element)
at Microsoft.VisualStudio.TestTools.UITest.Framework.AbstractUITestService.GetParent(UITechnologyElement element)
at Microsoft.VisualStudio.TestTools.UITesting.WinPropertyProvider.IsDatagridElement(UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.WinPropertyProvider.SetEditProperty(String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.WinPropertyProvider.SetPropertyValue(UITestControl uiControl, String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.UITestPropertyProvider.SetPropertyValueWrapper(UITestControl uiControl, String propertyName, Object value)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyValue(String propertyName, Object propertyValue)
Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.COMException
at Microsoft.VisualStudio.TestTools.UITest.Extension.IUITechnologyManager.GetParent(IUITechnologyElement element)
at Microsoft.VisualStudio.TestTools.UITesting.UITechnologyManagerProxy.GetParent(IUITechnologyElement element)
at Microsoft.VisualStudio.TestTools.UITest.Framework.AbstractUITestService.GetParent(UITechnologyElement element)
The control : "Technology Name: 'MSAA';Search Configuration: 'VisibleOnly'; Search Properties - ControlType : 'Window',ControlName : 'tableLayoutPanel1',Instance : '2'" could not be found under the container : "Search Configuration: 'VisibleOnly'; Search Properties - ControlType : 'Window',Name : 'Employer Picker',ClassName : 'WindowsForms10.Window'".
Technology Name: 'MSAA'
Search Configuration: 'VisibleOnly'
Search Properties -
ControlType : 'Edit'
Value set : 'cipher'
答案 0 :(得分:0)
这对Visual Studio 2015来说是个问题。它在VS 2012和2013中运行得很好。
如果它是相关的,我试图定位的特定控件是RadTextbox。