Silverlight xap をホストする asp.net ページにオブジェクトがあります (私の特定のケースでは IFrame にありますが、通常のオブジェクトにも興味があります)。UI Spy で要素を見つけることができますが、名前は "Silverlight Control" とだけ表示されています。自動テストで AutomationElement を見つけようとしても失敗します (コントロールは毎回 null です)。Silverlight コードまたは html に役立つ設定はありますか? 同じページに複数の Silverlight コントロールがある場合、どうすれば区別できますか?
<object id="silverlightClient" style="display:none;" data="data:application/x-silverlight-2," type="application/x-silverlight-2">
<param name="source" value="../../ClientBin/SilverlightApplication.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="#00000000" />
<param name="minRuntimeVersion" value="4.0.41019.0" />
<param name="autoUpgrade" value="true" />
<param name="windowless" value="false" />
</object>
TreeWalker tw = new TreeWalker(new System.Windows.Automation.PropertyCondition(AutomationElement.NameProperty, "Silverlight Control));
AutomationElement control = tw.GetFirstChild(ancestor);
UIスパイ
Identification
ClassName: "MicrosoftSilverlight"
ControlType: "ControlType.Window"
Culture: "(null)"
AutomationId: "71857844"
LocalizedControlType: "window"
Name: "Silverlight Control"
ProcessId: "7636 (iexplore)"
RuntimeId: "42 2163886"
IsPassword: "False"
IsControlElement: "True"
IsContentElement: "True"
編集:画像を追加しました。オブジェクトが IFrame 内にあることにも気付きました。 UISpyImage - タイトル名が削除されました