WPFアプリケーションから画像を取得しようとしています:
ご覧のとおり、画像はツリーの下にあります
"リモート電話" ウィンドウ > "" カスタム > "" 画像
テキストボックスとボタンを検索する方法 (およびボタンを呼び出す方法) の例を見つけましたが、画像を取得してフォームの画像ボックス内に表示できるコードをまだ見つけていません。
LogMessage("Getting RootElement...");
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)
etc..etc...
appElementは問題なく見つかりますが、 txtElementAに到達すると、picture/image 要素ではなくGetTextElementを探しているため、NULLになるはずです。
画像を見つけて取得し、フォームのピクチャボックス内に表示する際の適切なコードは何ですか?
ありがとう!