From 03b3e7464aa9951cd63319ef7aa7053a997e9e05 Mon Sep 17 00:00:00 2001 From: Jake Ginnivan Date: Sun, 9 Feb 2014 14:19:00 +0000 Subject: [PATCH] Hopefully fixing issue #165 --- .../UIItems/WindowItems/Win32Window.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/TestStack.White/UIItems/WindowItems/Win32Window.cs b/src/TestStack.White/UIItems/WindowItems/Win32Window.cs index 406b2807..feb8d73a 100644 --- a/src/TestStack.White/UIItems/WindowItems/Win32Window.cs +++ b/src/TestStack.White/UIItems/WindowItems/Win32Window.cs @@ -1,5 +1,8 @@ +using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Windows.Automation; +using TestStack.White.AutomationElementSearch; using TestStack.White.Factory; using TestStack.White.Sessions; using TestStack.White.UIItems.Finders; @@ -36,6 +39,16 @@ public override Window ModalWindow(string title, InitializeOption option) WindowSession.ModalWindowSession(option)); } + public override List ModalWindows() + { + var descendants = new AutomationElementFinder(automationElement) + .Children(new AutomationSearchConditionFactory().GetWindowSearchConditions(automationElement.Current.ProcessId).ToArray()); + + return descendants + .Select(descendant => ChildWindowFactory.Create(descendant, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache))) + .ToList(); + } + public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { return windowFactory.ModalWindow(searchCriteria, option, WindowSession.ModalWindowSession(option));