I am currently using the TestStack.White
framework to retrieve informations from an external Window
.
When the Window.DisplayState is Restored or Maximized, I can perfectly get the items that I want...but when it is Minimized, I am not able to see every item from the Window... the following examples shows the Google Chrome Items using commands in the Visual Studio
Immediate Window:
MAXIMIZED WINDOW:
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:}
MINIMIZED WINDOW:
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:}
As you guys can see, the above example shows 35 items when the Window
is Maximized, meanwhile the Minimized Window
is showing only 18 items.
If I want the Panel
183101736 (first position in Maximized Window
), it can be easily get using the following code:
TestStack.White.UIItems.Panel panel = Window.Get<TestStack.White.UIItems.Panel>(SearchCriteria.ByAutomationId("183101736"));
If the Window
is Minimized, I have to change its state manually using Window.DisplayState = DisplayState.Maximized... otherwise, it will raise the following Exception
. Is there a way to get "every" item without forcing the Window
to be opened?