this is my very basic code (i'm trying automate some tests on an application and am using messagebox to display my progress thru the app) I get passed "here 3" but I get stuck further with an error below code
1.Is there a way to highlight all the controls within eventTab2 (or any object that I nominate?like some sort of recursive get?) and also return the type of object it is with all it properties?
2. Could you explain the solution above so I can manipulate it (remember newbie)
THANKS!!!
1234567891011121314151617181920212223242526272829var mainWindow1 =newWpfWindow();mainWindow1.SearchProperties[WpfWindow.PropertyNames.Name] ="IntraBet [1.4.0.103] EQ3WNSTDB11";mainWindow1.SearchProperties.Add(newPropertyExpression(UITestControl.PropertyNames.ClassName,"HwndWrapper",PropertyExpressionOperator.Contains));mainWindow1.WindowTitles.Add("IntraBet [1.4.0.103] EQ3WNSTDB11");mainWindow1.DrawHighlight();var eventStack1 =newWpfCustom();var eventStack0 =newWpfCustom();var eventTab0 =newWpfTitleBar(mainWindow1);var eventTab1 =newWpfMenu(mainWindow1);var eventTab2 =newWpfTabList(mainWindow1);var eventTab3 =newWpfTreeItem(eventTab2);var eventTab4 =newWpfText(mainWindow1);MessageBox.Show("got here0");eventTab1.SearchProperties[WpfMenu.PropertyNames.AutomationId] ="menubar";eventTab1.DrawHighlight();MessageBox.Show("got here2");eventTab3.SearchProperties[WpfControl.PropertyNames.ClassName] ="MenuItem";eventTab3.DrawHighlight();MessageBox.Show("got here4");eventTab2.SearchProperties[WpfTabList.PropertyNames.AutomationId] ="windows";eventTab2.DrawHighlight();MessageBox.Show("got here3");eventTab0.SearchProperties[WpfCheckBox.PropertyNames.AutomationId] ="chkIncludeSetted";eventTab0.DrawHighlight();MessageBox.Show("got here1");
ERRoR
Test Name: CodedUITestMethod1
Test FullName: MSUItest.CodedUITest1.CodedUITestMethod1
Test Source: g:\CodedUITest1.cs : line 39
Test Outcome: Failed
Test Duration: 0:00:51.9135788
Result Message:
Test method MSUItest.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: 'UIA'
FrameworkId: 'Wpf'
ControlType: 'TreeItem'
ClassName: 'MenuItem'
Search may have failed at 'windows' TabList as it may have virtualized children. If the control being searched is descendant of 'windows' TabList then including it as the parent container may solve the problem. ---> 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.E ngine.IScreenElement.FindAllDescendants(String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth)
at Microsoft.VisualStudio.TestTools.UITest.Playback.S creenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId, Boolean throwException, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITest.Playback.S creenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.TestTools.UITesting.Playbac k.MapControlNotFoundException(COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playbac k.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playbac k.MapAndThrowException(Exception exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playbac k.MapAndThrowException(Exception exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchH elper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchH elper.Search(ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.FindControlIfNecessary()
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.DrawHighlightPrivate()
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.b__36()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUI TestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestC ontrol.DrawHighlight()
at MSUItest.CodedUITest1.CodedUITestMethod1() in g:\CodedUITest1.cs:line 76
Loading
Replies
Know the answer? Post it — somebody with the same question will find it here.