Skip to content

Commit 03e879b

Browse files
committed
Merge pull request #221 from JakeGinnivan/Win32FindModelWindows
Hopefully fixing issue #165
2 parents 83add85 + 03b3e74 commit 03e879b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/TestStack.White/UIItems/WindowItems/Win32Window.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
using System.Collections.Generic;
12
using System.Diagnostics;
3+
using System.Linq;
24
using System.Windows.Automation;
5+
using TestStack.White.AutomationElementSearch;
36
using TestStack.White.Factory;
47
using TestStack.White.Sessions;
58
using TestStack.White.UIItems.Finders;
@@ -36,6 +39,16 @@ public override Window ModalWindow(string title, InitializeOption option)
3639
WindowSession.ModalWindowSession(option));
3740
}
3841

42+
public override List<Window> ModalWindows()
43+
{
44+
var descendants = new AutomationElementFinder(automationElement)
45+
.Children(new AutomationSearchConditionFactory().GetWindowSearchConditions(automationElement.Current.ProcessId).ToArray());
46+
47+
return descendants
48+
.Select(descendant => ChildWindowFactory.Create(descendant, InitializeOption.NoCache, WindowSession.ModalWindowSession(InitializeOption.NoCache)))
49+
.ToList();
50+
}
51+
3952
public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option)
4053
{
4154
return windowFactory.ModalWindow(searchCriteria, option, WindowSession.ModalWindowSession(option));

0 commit comments

Comments
 (0)