Skip to content

Commit

Permalink
>_<
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Ginnivan committed Jul 31, 2013
1 parent 676070d commit a5adefd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/TestStack.White/UIItems/MenuItems/Menus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Threading;
using System.Windows.Automation;
using TestStack.White.AutomationElementSearch;
using TestStack.White.Configuration;
using TestStack.White.Factory;
using TestStack.White.UIItems.Actions;
using TestStack.White.UIItems.Finders;
using TestStack.White.Utility;

namespace TestStack.White.UIItems.MenuItems
{
Expand All @@ -19,7 +21,7 @@ public Menus(AutomationElement parent, ActionListener actionListener)
if (parent == null) throw new ArgumentNullException("parent", "You must specify a parent automation id when creating a menu");
AutomationSearchCondition condition = AutomationSearchCondition.ByControlType(ControlType.MenuItem);
var finder = new AutomationElementFinder(parent);
finder = PerformanceHackAsPopupMenuForWin32AppComesOnDesktop(finder, parent);
finder = Retry.For(()=> PerformanceHackAsPopupMenuForWin32AppComesOnDesktop(finder, parent), CoreAppXmlConfiguration.Instance.BusyTimeout());
List<AutomationElement> children = finder.Descendants(condition);
foreach (AutomationElement child in children)
Add((Menu) Factory.Create(child, actionListener));
Expand All @@ -36,6 +38,7 @@ private static AutomationElementFinder PerformanceHackAsPopupMenuForWin32AppCome
AutomationElement windowElement = finder.Child(AutomationSearchCondition.ByControlType(ControlType.Window));
menuElement = new AutomationElementFinder(windowElement).Child(AutomationSearchCondition.ByControlType(ControlType.Menu));
}
if (menuElement == null) throw new UIItemSearchException("Could not find Menu");
finder = new AutomationElementFinder(menuElement);
}
return finder;
Expand Down

0 comments on commit a5adefd

Please sign in to comment.