Action Recording Playback does not find window
-
2012年2月14日 15:33
I have the following action recording:
---------------------
Start testing
Parent window changed to '* Neu * - EAWS Digital v1.2.12044.5'
Click 'Unknown Name' pane
Type 'Dresden 1' in 'TextBoxPlant' text box
Type 'A' in 'TextBoxLIne' text box
Type 'Test zum Löschen einer vorhandenen Analyse' in 'TextBoxDetails' text box....
----------------------
Since the window title is dynamic containing the opened file, version number and localized. Why the action recording is not preferring AutomationID or Name if available?
- 已移动 Forrest GuoModerator 2012年2月29日 1:24 (From:Visual Studio UI Automation Testing (includes CodedUI))
全部回复
-
2012年2月18日 16:20版主
Hi,
If your application windows has the AutomationID, you could choose to use that in CodedUI test. Generally developer needs to add this in design.
You can set search properties when locate the UI element. Visual Studio Feature Pack2 contains feature that allows people to configure Coded UI test visually. You can select the control in UI Map and modify its search properties.
Visual Studio Feature Pack2 could be downloaded at: http://msdn.microsoft.com/en-us/vstudio/ff655021 MSDN subscription is required.
Please let me know if there's anything unclear, I'll try to assist.
Best Regards,
Forrest Guo | MSDN Community Support | Feedback to us
-
2012年2月20日 2:51
I believe there is a bug in Dev10 wherein any property other that window relevant properties (Name, ControlType, ClassName, ControlId, ControlName) is ignored for the TopLevelWindow. So you need to be cautious in setting the search property of the top level window. 'Name' property should just work fine.
Thanks,
~ Tapas
- 已建议为答案 Forrest GuoModerator 2012年2月23日 2:02
- 取消建议作为答案 Forrest GuoModerator 2012年2月27日 1:45
-
2012年2月23日 9:21I don't mean Coded UI Tests. A tester can not develop! He can only record and play action recordings.
-
2012年2月23日 14:37版主
Hi,
I got your point, the test engineer just record and replay the scenarios. However, he may look into the recorded test and fine tune it. If he can not tune, a developer may help over there.
Best Regards,
Forrest Guo | MSDN Community Support | Feedback to us
-
2012年2月27日 2:10版主
Hi,
Based on your description, you might be using Microsoft Test Manager, test recorder. If that's the case, we have dedicated forum for it. I can move the thread over.
Would you please check the Playback Error dialog, copy the Error details and paste over here?
Thanks.
Forrest Guo | MSDN Community Support | Feedback to us
-
2012年2月27日 11:00
For Example:
Log
Steps Detailed actions
2 Home Menü öffnen Parent window changed to '* Neu * - EAWS Digital v1.2.12044.8'
Click 'RibbonApplicationMenu' popup menuDetails
Exception:
The playback failed to find the control with the given search properties. Additional Details: TechnologyName: 'UIA' ControlType: 'Menu' AutomationId: 'RibbonApplicationMenu' Search may have failed at '' TabList as it may have virtualized children. If the control being searched is descendant of '' TabList then including it as the parent container may solve the problem.Failed action:
Click 'RibbonApplicationMenu' popup menuPrimary search properties:
Property Value
ControlType Menu
AutomationId RibbonApplicationMenu -
2012年2月29日 2:52版主
Hi,
I have tried to reproduce the issue in Test Runner, but it doesn't reproduce with a small sample winform app. What I did:
- Start the Winform application Application started by launching shortcut.
- Locating Winform title bar Locating the winform successfully
- Locating textbox Locate the textbox successfully.
- Click Pick File button Open file dialog opens
- Select file of localized file name Text box filled with selected file name
- Relocate textbox textbox filled with localized text
- Relocate winform title bar title bar filled with localized file name
As I don't have your application detail, like the menu etc. The steps are not that exact as yours. But this at least proves window with dymanic title could be located without problem.
On the othe hand, I don't see there's a way to tune action recording details, like in Exception details, the search properties. But anyway, you think about the tips in that exception.
Let me know if you can provide more application details, so I may look further into it.
Regards,
Forrest Guo | MSDN Community Support | Feedback to us
- 已编辑 Forrest GuoModerator 2012年2月29日 2:54
- Start the Winform application Application started by launching shortcut.
-
2012年3月2日 1:46版主
Herwig,
I'm wondering if you have some progress of this issue. Basically there'e few actions we can take in Test Manager. If you work together with the that application development team, you may consult them with the exception. Or you may contact Microsoft professional phone support, they will provided more in-depth level support.
http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.
Thanks,
Forrest Guo | MSDN Community Support | Feedback to us
- 已编辑 Forrest GuoModerator 2012年3月2日 5:17
-
2012年3月2日 15:46
Hello,
Herwig asked me to provide a small example because I am the one who ran into trouble with the Test Manager. He's the developer who might be responsible.
Somebody already told me, that there is no possibility to get the action playback working with dynamic window titles. I have to use Coded UI Tests for that. But there is still another problem with the action playback. I am not able to access any menu item in our ribbon menu. Even the smallest action recording (start & close the application) fails.
Here is the XAML code of the small example:
<ribbon:RibbonWindow x:Class="RibbonExample.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" Title="MainWindow" Height="350" Width="525"> <DockPanel> <ribbon:Ribbon x:Name="Ribbon" DockPanel.Dock="Top"> <ribbon:Ribbon.ApplicationMenu> <ribbon:RibbonApplicationMenu x:Name="RibbonApplicationMenu" SmallImageSource="/Icons/ribbon_list.png" > <ribbon:RibbonApplicationMenuItem Header="Out Of Order" x:Name="MenuItem1" ImageSource="/Icons/button1.png" /> <ribbon:RibbonApplicationMenuItem Header="Out Of Order" x:Name="MenuItem2" ImageSource="/Icons/button2.png" /> <ribbon:RibbonSeparator /> <ribbon:RibbonApplicationMenu.FooterPaneContent> <DockPanel LastChildFill="False"> <ribbon:RibbonButton Command="ApplicationCommands.Close" Label="Exit" SmallImageSource="/Icons/close.png" KeyTip="X" DockPanel.Dock="Right" Margin="2"/> </DockPanel> </ribbon:RibbonApplicationMenu.FooterPaneContent> </ribbon:RibbonApplicationMenu> </ribbon:Ribbon.ApplicationMenu> <ribbon:RibbonTab x:Name="HomeTab" Header="Home"> <ribbon:RibbonGroup x:Name="GroupA" Header="Group A"> <ribbon:RibbonButton x:Name="RibbonButton2" LargeImageSource="/Icons/button2.png" Label="Some Action" /> </ribbon:RibbonGroup> </ribbon:RibbonTab> </ribbon:Ribbon> <StackPanel DockPanel.Dock="Bottom" > <GroupBox Name="Testcase1" Header="Testcase 1" > <RichTextBox> <FlowDocument> <Paragraph> Try to do the following: </Paragraph> <List> <ListItem> <Paragraph>Start the application</Paragraph> </ListItem> <ListItem> <Paragraph>Close the application (Use the Exit-button in the ribbon menu)</Paragraph> </ListItem> <ListItem> <Paragraph>Automate these steps with Microsoft Test and Lab Manager</Paragraph> </ListItem> </List> </FlowDocument> </RichTextBox> </GroupBox> </StackPanel> </DockPanel> </ribbon:RibbonWindow>There is no more logic than the command binding "ApplicationCommands.Close" -
2012年3月8日 15:47版主
Hi Tobias, Herwig
Sorry getting back late. I managed to get above xmal sample running, and it turns out I can reproduce the problem. CodedUI test builder just could not address WPF ribbon button. I have just created an issue on Connect website to track this issue. Product team supposed to evaluate this and follow up. https://connect.microsoft.com/VisualStudio/feedback/details/729724/fail-to-identify-wpf-ribbon-button-in-codedui-test
Btw, another community member has mentioned a workaround, that is to write automation code, you may refer to it for idea. Note that I haven't test it. http://social.msdn.microsoft.com/Forums/en-US/windowsribbondevelopment/thread/fb82ab84-c00c-46fe-9af8-89f06ff049fb
AutomationElement shellVlewWindow = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "ShellView")); AutomationElement ribbon = shellVlewWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "ribbon")); AutomationElement accountsTabView = ribbon.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, "HomeTabView")); AutomationElementCollection accountsTabButtons = accountsTabView.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, "RibbonToggleButton")); AutomationElement accountsButton = accountsTabButtons.OfType<AutomationElement>().SingleOrDefault(i => i.GetCurrentPropertyValue(AutomationElement.NameProperty).ToString() == "Accounts"); System.Windows.Point accountsButtonPoint = (System.Windows.Point)accountsButton.GetCurrentPropertyValue(AutomationElement.ClickablePointProperty); Mouse.Click(new System.Drawing.Point((int)accountsButtonPoint.X, (int)accountsButtonPoint.Y));
Best Regards,Forrest Guo | MSDN Community Support | Feedback to us
- 已标记为答案 niveditabawa_MSFTMicrosoft Employee, Moderator 2012年3月19日 11:59
-
2012年3月12日 11:22Hi Forrest,
thanks a lot for your help!
I will try the proposed workaround in the next day. Nevertheless I hope that the MS Ribbon development team will fix this issue in the next months. Otherwise it will put back our aspired test automation plans for years.

