Get AutomationElement for a WPF Popup

I am working on a project that uses a popup in the editor to provide double-click objects to ListBox users to add to their document. I am trying to create automated tests for an application using the automation API provided by Microsoft, but I cannot figure out how to get the AutomationElement for the Popup control, since it is in a different tree than my editor and its controls. Does anyone know how to get AutomationElement for a WPF popup?

+6
source share
2 answers

I had to get started with Desktop and query through the automation tree, using some very specific PropertyConditions in combination with AndCondition, using TreeScope.Descendants as a parameter for my queries.

+2
source

I have an AutomationElement popup for a popup ( OpenFileDialog in my case) from the children main window:

 // I had automationElement for main window in advance AutomationElement mainWindow = ... // Some condition to distinguish your popup from others // if you may have more than one popup. // Otherwise this condition might check ControlType == Window Condition popupCondition = ... var popup = mainWindow.FindFirst(TreeScope.Children, popupCondition); 
0
source

Source: https://habr.com/ru/post/887465/


All Articles