WPF UI Automation finding image
Hey all i am trying to get an image from a WPF application:
As you can see the image is under the tree
"Remote phone" window > "" custom > "" image
I've found examples of how to find a textbox and button (and also invoking the button) but i have not yet found code that will allow me to get an image and display it within my form picturebox.
It finds the appElement just fine but once it gets to the txtElementA it's *NULL* which it should be since its looking for a GetTextElement instead of a picture/image element.
AutomationElement rootElement = AutomationElement.RootElement;
if (rootElement != null)
LogMessage("OK." + Environment.NewLine);
Automation.Condition condition = new PropertyCondition(AutomationElement.NameProperty, "Remote phone");
LogMessage("Searching for Remote Phone Window...");
AutomationElement appElement = rootElement.FindFirst(TreeScope.Children, condition);
if (appElement != null)
LogMessage("OK " + Environment.NewLine);
LogMessage("Searching for Image...");
AutomationElement txtElementA = GetTextElement(appElement, "image");
if (txtElementA != null)
What would be the proper code in finding the image and grabbing it and then displaying it within a picturebox on my form?