C# TestStack.White - Get Window.Items correctly from an minimized Window
<p>I am currently using the <code>TestStack.White</code> framework to retrieve informations from an external <code>Window</code>.</p>
<p>When the <strong>Window.DisplayState</strong> is <strong>Restored</strong> or <strong>Maximized</strong>, I can perfectly get the items that I want...but when it is <strong>Minimized</strong>, I am not able to see every item from the Window... the following examples shows the Google Chrome Items using commands in the <code>Visual Studio</code> <strong>Immediate Window</strong>:</p>
<p><strong>MAXIMIZED WINDOW:</strong></p>
<pre><code>Window.DisplayState (COMMAND)
Maximized
Window.Items (COMMAND)

Count = 35
[0]: {Panel. AutomationId:183101736, Name:Chrome Legacy Window, ControlType:painel, FrameworkId:Win32}
[1]: {MenuBar. AutomationId:SystemMenuBar, Name:Barra de menus do sistema, ControlType:barra de menus, FrameworkId:Win32}
[2]: {Button. AutomationId:Minimize, Name:Minimizar, ControlType:botão, FrameworkId:Win32}
[3]: {Button. AutomationId:Restore, Name:Restaurar, ControlType:botão, FrameworkId:Win32}
[4]: {Button. AutomationId:Close, Name:Fechar, ControlType:botão, FrameworkId:Win32}
[5]: {CustomUIItem. AutomationId:, Name:Google Chrome, ControlType:personalizado, FrameworkId:}
[6]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[7]: {Button. AutomationId:, Name:Murilo, ControlType:botão, FrameworkId:}
[8]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[9]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[10]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[11]: {Tab. AutomationId:, Name:, ControlType:guia, FrameworkId:}
[12]: {Button. AutomationId:, Name:Nova guia, ControlType:botão, FrameworkId:}
[13]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[14]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[15]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[16]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[17]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[18]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[19]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[20]: {Button. AutomationId:, Name:Fechar, ControlType:botão, FrameworkId:}
[21]: {ToolStrip. AutomationId:, Name:main, ControlType:barra de ferramentas, FrameworkId:}
[22]: {Button. AutomationId:, Name:Recarregar, ControlType:botão, FrameworkId:}
[23]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[24]: {Button. AutomationId:, Name:Adicionar esta página aos favoritos, ControlType:botão, FrameworkId:}
[25]: {CustomUIItem. AutomationId:, Name:Extensões, ControlType:personalizado, FrameworkId:}
[26]: {Button. AutomationId:, Name:AdBlock - clique para detalhes, ControlType:botão, FrameworkId:}
[27]: {Button. AutomationId:, Name:Tampermonkey, ControlType:botão, FrameworkId:}
[28]: {ToolStrip. AutomationId:, Name:Favoritos, ControlType:barra de ferramentas, FrameworkId:}
[29]: {Button. AutomationId:, Name:AAA, ControlType:botão, FrameworkId:}
[30]: {Button. AutomationId:, Name:BBB, ControlType:botão, FrameworkId:}
[31]: {Button. AutomationId:, Name:CCC, ControlType:botão, FrameworkId:}
[32]: {Button. AutomationId:, Name:DDD, ControlType:botão, FrameworkId:}
[33]: {Button. AutomationId:, Name:EEE, ControlType:botão, FrameworkId:}
[34]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
</code></pre>
<p><strong>MINIMIZED WINDOW:</strong></p>
<pre><code>Window.DisplayState (COMMAND)
Minimized
Window.Items (COMMAND)

Count = 19
[0]: {MenuBar. AutomationId:SystemMenuBar, Name:Barra de menus do sistema, ControlType:barra de menus, FrameworkId:Win32}
[1]: {Button. AutomationId:Restore, Name:Restaurar, ControlType:botão, FrameworkId:Win32}
[2]: {Button. AutomationId:Maximize, Name:Maximizar, ControlType:botão, FrameworkId:Win32}
[3]: {Button. AutomationId:Close, Name:Fechar, ControlType:botão, FrameworkId:Win32}
[4]: {CustomUIItem. AutomationId:, Name:Google Chrome, ControlType:personalizado, FrameworkId:}
[5]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[6]: {Button. AutomationId:, Name:Murilo, ControlType:botão, FrameworkId:}
[7]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[8]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[9]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[10]: {Tab. AutomationId:, Name:, ControlType:guia, FrameworkId:}
[11]: {Button. AutomationId:, Name:Nova guia, ControlType:botão, FrameworkId:}
[12]: {ToolStrip. AutomationId:, Name:main, ControlType:barra de ferramentas, FrameworkId:}
[13]: {Button. AutomationId:, Name:Recarregar, ControlType:botão, FrameworkId:}
[14]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
[15]: {Button. AutomationId:, Name:Adicionar esta página aos favoritos, ControlType:botão, FrameworkId:}
[16]: {CustomUIItem. AutomationId:, Name:Extensões, ControlType:personalizado, FrameworkId:}
[17]: {ToolStrip. AutomationId:, Name:Favoritos, ControlType:barra de ferramentas, FrameworkId:}
[18]: {CustomUIItem. AutomationId:, Name:, ControlType:personalizado, FrameworkId:}
</code></pre>
<p>As you guys can see, the above example shows 35 items when the <code>Window</code>is <strong>Maximized</strong>, meanwhile the <strong>Minimized</strong> <code>Window</code> is showing only 18 items.</p>
<p>If I want the <code>Panel</code>183101736 (first position in <strong>Maximized</strong> <code>Window</code>), it can be easily get using the following code:</p>
<pre><code>TestStack.White.UIItems.Panel panel = Window.Get&lt;TestStack.White.UIItems.Panel&gt;(SearchCriteria.ByAutomationId(&quot;183101736&quot;));
</code></pre>
<p>If the <code>Window</code>is <strong>Minimized</strong>, I have to change its state manually using <em>Window.DisplayState = DisplayState.Maximized</em>... otherwise, it will raise the following <code>Exception</code>. Is there a way to get &quot;every&quot; item without forcing the <code>Window</code>to be opened?</p>
<p><a href="https://i.stack.imgur.com/JMF5D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JMF5D.png" alt="AutomationException" /></a></p>