Automation of Context menu takes long time to retrieve the element and perform action on it
-
Thursday, September 13, 2012 1:10 PM
We have performing Automation on our app successfully but we are facing few performance related issue in Automation of context menu where it takes long time for identification of elements in context menu and then based on identification if performs action.
Below is the snippet of the code we have used , it would be great if we could get some help on tweaking the code for performance improvement.
//Getting the Context Menu child object ...
WpfMenu objMenuItem = new WpfMenu(ParentTableObject);
objMenuItem.SearchProperties.Add(WpfMenu.PropertyNames.ClassName, "Uia.ContextMenu", PropertyExpressionOperator.EqualTo);
for (int j = 1; j < objMenuItem.GetChildren().Count; j++)
{
if (objMenuItem.GetChildren()[j].GetProperty(WpfMenuItem.PropertyNames.Name).ToString() == LinePosName)
{
LinePos = j;
break;
}
}
Mouse.Click(objMenuItem.GetChildren()[LinePos]);
All Replies
-
Monday, September 17, 2012 9:29 AMModerator
Hi Gleeson,
Thank you for posting in the MSDN forum.
My suggestion is that we would check which line code or control impacted the playback action, and then we could try to improve the performance.
Automation of context menu where it takes long time for identification of elements in context menu and then based on identification if performs action.
If we could make sure that which control generated this issue, we could try to add the more appropriate search properties and check it again.
In addition, there are two blogs about improving the performance of your Coded UI tests. Maybe it could help.
See:
Improving the performance of your Coded UI tests
Guidelines on improving performance of Coded UI Test playback
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- Edited by Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator Monday, September 17, 2012 9:31 AM
-
Wednesday, September 19, 2012 11:14 AMModerator
Hi Gleeson,
Could you get useful information from the reply? Have you solved this issue?
If not, please let us know the latest news about this issue.
Thank you for your understanding!
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
-
Thursday, September 20, 2012 8:31 AM
Hi Jack,
Thanks for the quick response could not reply back since was stuck on some priority task.
Regarding the context menu we reduced the lag issue by just changing the parent object applicable for the control.
Now the issue that we were facing was when we right click on the grid we get a context menu and then the operation is selected from that context menu now the parent object that we initially used was grid since we assumed that it was the child of grid and it was working fine with the lag issue.
But when we analysed for the lag issue we noticed that the parent of the context menu was application window instead of the grid so just changing the parent object improved the performance of the code.
Thanks & Regards
Gleeson
- Marked As Answer by Gleeson Thursday, September 20, 2012 8:31 AM

