Here are the details of my Development Environment:
Visual Studio 2012 Ultimate with Update 4 Google Chrome Version 38.0.2125.111 m Windows 7 Professional with 32-bit Operating System Coded UITest Builder 11.0.60315.1
Our software team is creating an ASP.NET web application, and the customer has requested that we use Microsoft Visual Studio 2012 with Microsoft CodedUI to run automated tests.
I ran our ASP.NET application in Google Chrome Version 38.0.2125.111 m I took steps to use the Microsoft CodedUI to record some Browser-user interaction steps on our ASP.NET application which ultimately led to generating some code. The following is the generated code based on the recorded Brower-user interaction that I conducted on our ASP.NET Web Application
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by coded UI test builder.
// Version: 11.0.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace JigsawEMISTCodedUITestProject
{
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Input;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
using MouseButtons = System.Windows.Forms.MouseButtons;
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;
[GeneratedCode("Coded UITest Builder", "11.0.60315.1")]
public partial class UIMap
{
/// <summary>
/// RecordedMethod1
/// </summary>
public void RecordedMethod1()
{
#region Variable Declarations
WinClient uIChromeLegacyWindowClient = this.UIJigsawBetaEnviromentWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowClient;
#endregion
// Click 'Chrome Legacy Window' client
Mouse.Click(uIChromeLegacyWindowClient, new Point(151, 25));
// Click 'Chrome Legacy Window' client
Mouse.Click(uIChromeLegacyWindowClient, new Point(150, 35));
// Click 'Chrome Legacy Window' client
Mouse.Click(uIChromeLegacyWindowClient, new Point(709, 90));
}
#region Properties
public UIJigsawBetaEnviromentWindow UIJigsawBetaEnviromentWindow
{
get
{
if ((this.mUIJigsawBetaEnviromentWindow == null))
{
this.mUIJigsawBetaEnviromentWindow = new UIJigsawBetaEnviromentWindow();
}
return this.mUIJigsawBetaEnviromentWindow;
}
}
#endregion
#region Fields
private UIJigsawBetaEnviromentWindow mUIJigsawBetaEnviromentWindow;
#endregion
}
[GeneratedCode("Coded UITest Builder", "11.0.60315.1")]
public class UIJigsawBetaEnviromentWindow : WinWindow
{
public UIJigsawBetaEnviromentWindow()
{
#region Search Criteria
this.SearchProperties[WinWindow.PropertyNames.Name] = "Jigsaw [Beta Enviroment] - Google Chrome";
// this.SearchProperties[WinWindow.PropertyNames.Name] = "Jigsaw";
this.SearchProperties[WinWindow.PropertyNames.ClassName] = "Chrome_WidgetWin_1";
// this.SearchProperties[WinWindow.PropertyNames.ClassName] = "Chrome";
this.WindowTitles.Add("Jigsaw [Beta Enviroment] - Google Chrome");
// this.WindowTitles.Add("Jigsaw");
#endregion
}
#region Properties
public UIChromeLegacyWindowWindow UIChromeLegacyWindowWindow
{
get
{
if ((this.mUIChromeLegacyWindowWindow == null))
{
this.mUIChromeLegacyWindowWindow = new UIChromeLegacyWindowWindow(this);
}
return this.mUIChromeLegacyWindowWindow;
}
}
#endregion
#region Fields
private UIChromeLegacyWindowWindow mUIChromeLegacyWindowWindow;
#endregion
}
[GeneratedCode("Coded UITest Builder", "11.0.60315.1")]
public class UIChromeLegacyWindowWindow : WinWindow
{
public UIChromeLegacyWindowWindow(UITestControl searchLimitContainer) :
base(searchLimitContainer)
{
#region Search Criteria
this.SearchProperties[WinWindow.PropertyNames.ControlId] = "144212160";
this.WindowTitles.Add("Jigsaw [Beta Enviroment] - Google Chrome");
// this.WindowTitles.Add("Jigsaw");
#endregion
}
#region Properties
public WinClient UIChromeLegacyWindowClient
{
get
{
if ((this.mUIChromeLegacyWindowClient == null))
{
this.mUIChromeLegacyWindowClient = new WinClient(this);
#region Search Criteria
this.mUIChromeLegacyWindowClient.SearchProperties[WinControl.PropertyNames.Name] = "Chrome Legacy Window";
// this.mUIChromeLegacyWindowClient.SearchProperties[WinControl.PropertyNames.Name] = "Chrome";
this.mUIChromeLegacyWindowClient.WindowTitles.Add("Jigsaw [Beta Enviroment] - Google Chrome");
// this.mUIChromeLegacyWindowClient.WindowTitles.Add("Jigsaw");
#endregion
}
return this.mUIChromeLegacyWindowClient;
}
}
#endregion
#region Fields
private WinClient mUIChromeLegacyWindowClient;
#endregion
}
}
Microsoft CodedUI is throwing Error because it fails to see 'Chrome Legacy Window'
I ran the code, but I get the following Error:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException was unhandled by user code
HResult=-268111872
Message=The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
ControlType: 'Client'
Name: 'Chrome Legacy Window'
Source=Microsoft.VisualStudio.TestTools.UITesting
BasicMessage=The playback failed to find the control with the given search properties.
RootElement=""
StackTrace:
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 (SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException (SystemException 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.FindPrivate()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__d()
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__DisplayClass11.<GetProperty>b __10()
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)
at JigsawEMISTCodedUITestProject.UIMap.RecordedMethod1() in d:\EMIS\JigsawEMISTCodedUITestProject\JigsawEMISTCodedUITestProject\UIMap.cs:line 42
at JigsawEMISTCodedUITestProject.CodedUITest1.CodedUITestMethod1() in d:\EMIS\JigsawEMISTCodedUITestProject\JigsawEMISTCodedUITestProject\CodedUITest1.cs:line 30
InnerException: System.Runtime.InteropServices.COMException
HResult=-2147467259
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
Source=Microsoft.VisualStudio.TestTools.UITest.Playback
ErrorCode=-2147467259
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.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
InnerException:
Do I need to install some drivers for popular browsers ( i.e Google Chrome, Mozilla Firefox, IE, etc.) ? I restarted my development computer a couple times, but still have same problem. Please help me.