This is a migrated thread and some comments may be shown as answers.

UI Test Control not found Exception

4 Answers 376 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Tulika
Top achievements
Rank 1
Tulika asked on 15 Dec 2015, 10:41 AM

Hi Team,

I am working on a WPF application which extensively uses Telerik controls.We are trying to automate few scenarios in our application. As a beginner in Coded UI I started by recording a simple flow, however while replaying the same ,faced couple of issues highlighted below

Note: We are using  Telerik version -2014.3.1202.40

Script not identifying ControlType-:TabPage,this control is located inside rbrMain.
Refer attachment –screenshot 1 & 2. Find Below the error message I receive:
Test Name:         CodedUITestMethod1
Test FullName:   CodedUITestProject_IncentBasic.CodedUITest1.CodedUITestMethod1
Test Source:        <<Project code>> failed at
Test Outcome:   Failed
Test Duration:    0:00:34.7996513
Result Message:              
Test method CodedUITestProject_IncentBasic.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search

properties. Additional Details:
TechnologyName:  'MSAA'
ControlType:  'TabPage'
Name:  'Data'
 ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Result StackTrace:           
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.FindAllDescendants(String bstrQueryId, Object& pvarResKeys, Int32

cResKeys, Int32 nMaxDepth)
   at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId,

Boolean throwException, Boolean resetSkipStep)
   at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
 --- End of inner exception stack trace ---
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, IPlaybackContext context)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String queryId)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
   at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
   at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__37()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean

firePlaybackErrorEvent, Boolean logAsAction)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3b.<GetProperty>b__3a()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean

firePlaybackErrorEvent, Boolean logAsAction)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
   at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl(UITestControl uiTestControl)
   at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor(UITestControl uiControl)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation(UITestControl control, MouseButtons button, ModifierKeys modifierKeys,

Point relativeCoordinate)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean

firePlaybackErrorEvent, Boolean logAsAction)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point

relativeCoordinate)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)



When trying to click on buttons located on RBR main and not on TabPage control script is still not identifying those objects and failing on replay:
Refer Screenshot 3  in attachment .
Find below the error message.


Result Message:              
Test method Incent_Scenario2_ClickOnReportButton.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:

TechnologyName:  'MSAA'
ControlType:  'Button'
Name:  'Reports'

 ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Result StackTrace:           
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.FindAllDescendants(String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth)
   at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId, Boolean throwException, Boolean resetSkipStep)
   at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
 --- End of inner exception stack trace ---
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, IPlaybackContext context)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String queryId)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
   at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
   at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__37()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3b.<GetProperty>b__3a()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
   at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
   at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl(UITestControl uiTestControl)
   at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor(UITestControl uiControl)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
   at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)



4 Answers, 1 is accepted

Sort by
0
Tulika
Top achievements
Rank 1
answered on 15 Dec 2015, 10:44 AM

I am looking forward   to reply from you guys. Do let me know if you require any further information.

Thanks in Advance!!!!

0
Peshito
Telerik team
answered on 16 Dec 2015, 12:48 PM
Hi Tulika,

We are unaware of such issue with the Coded UI support for our controls. I tried to reproduce it with a sample RibbonView application and a Coded UI test project with a test run against it and it worked fine. Please find attached both samples in this thread.

I would suggest you to take a look at our online help topic regarding Coded UI Support with Telerik UI for WPF to check whether you have properly set your test project.

Hope this helps.


Regards,
Peshito
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tulika
Top achievements
Rank 1
answered on 22 Dec 2015, 09:51 AM

Hi Peshito/Team,

Thanks for your quick response! It was helpful .

I  followed link http://docs.telerik.com/devtools/wpf/coded-ui-support.html .

I have a query  regarding Telerik Extensions and how to install them. One of the steps mentioned in support link is as:

 You will find the following foldiers in your UI for WPF installation folder - (usually C:\Program Files\Telerik\UI for WPF [version]\Binaries\WPF40\TestTools\VS[version]).

 I do not have Telerik components installed on my system.I am from  testing Team and want to initiate automated testing using Coded UI for our  window application  (ClickOnce Application Reference (.appref-ms) type of application).I replayed a simple recorded script where it failed to identify Telerik components which have been used extensively in the application under test.

As per your last reply and support link  it  appears  there are some Telerik extension which I need to install in GAC .

I  went to Visual Studio Project-ManageNuGetPackages --Online --and I am trying to install the required Telerik Control but quite

conf used with the search results.Refer attached screenshot.

Please do let me know if the approach I  am trying to follow of adding  Telerik extension is correct or not?

It will also be helpful if you can let me know any other TelerikTool  I need  to use.

 

Kindly keep me posted.

Thanks,

Tulika

 

0
Peshito
Telerik team
answered on 24 Dec 2015, 08:05 AM
Hello Tulika,

I am glad the information provided earlier was helpful.

In order to be able to find Telerik controls in the application under test the Telerik.VisualStudio.TestTools.UITest.Extension.ExtensionsCore assembly is required. Without adding it to the specified folder location mentioned in the help article you will not be able to properly locate the controls by Telerik.

After adding the Telerik.VisualStudio.TestTools.UITest.Extension.ExtensionsCore assembly at the proper location you will then be able to install it into the GAC. Let's say you have Visual Studio 2013 installed on your machine. After opening the Visual Studio Command Prompt, the command you need to execute should look like:
cd C:\Program Files (x86)\Common Files\Microsoft Shared\VSTT\12.0\UITestExtensionPackages
gacutil -i Telerik.VisualStudio.TestTools.UITest.Extension.ExtensionsCore.dll


Doing the above will be enough for your Coded UI test project to be able to find the Telerik controls.

Regards,
Peshito
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TabControl
Asked by
Tulika
Top achievements
Rank 1
Answers by
Tulika
Top achievements
Rank 1
Peshito
Telerik team
Share this question
or