非貪欲検索について
非貪欲検索では、指定した属性に一致する類似のアプリケーションのプールからターゲット要素を特定することができます。セレクターのトップレベルのタグに含める必要があります。
非貪欲検索の仕組み
セレクターに非貪欲検索を適用すると、フォーカスしているウィンドウ インスタンスだけでなく、セレクターのトップレベルのタグに一致するすべてのアクティブなウィンドウまたはブラウザー インスタンスが検索されます。非貪欲検索では、次のようにトップレベルのタグに含める必要がある idx()
属性を使用します。
Option | Description |
---|---|
<idx='*'> | Searches through all active window instances for the element matching the top-level tag attributes. Please note that the <idx='1'> option only searches through window instances in focus. |
現在、次のセレクターの種類に対して非貪欲検索がサポートされています。
Selector Type | Support |
---|---|
<wnd> | ![]() |
<html> | ![]() |
<webctrl> | ![]() |
<java> | ![]() |
<ctrl> | ![]() |
<sap> | ![]() |
<silverlight> | ![]() |
Selectors inside the following containers: Open Application Open Browsers Attach Window Attach Browser | ![]() |
Universal Windows Platform (UWP) applications | ![]() |
非貪欲検索の使用例
この例の目的のために、Windows 10 の電卓アプリを操作するオートメーション プロセスを作成するとします。ただし、標準の電卓とプログラマー電卓の 2 つのアクティブ インスタンスが存在します。操作が必要なのは標準電卓のみであるため、トップレベルのタグ (この例では <wnd>
) に idx='*'
オプションを導入します。探している電卓のインスタンスを返す、次のセレクターが生成されます。
<wnd app='applicationframehost.exe' appid='Microsoft.WindowsCalculator_8wekyb3d8bbwe!App'
title='Calculator' idx='*' />
<uia cls='LandmarkTarget' />
<uia automationid='ProgrammerOperators' cls='NamedContainerAutomationPeer' name='Radix selection' />
<uia automationid='hexButton' cls='RadioButton' name='HexaDecimal 0 ' />
2 年前に更新