# 要素の検索

現在のノードでは、以下の操作が可能です。

1. 現在のページ上のビューツリー要素を検索し、[要素のタップ](/ja/rparobotic-process-automation/03-node/01-simulation-operations/04-tap-element) ノードを使用して要素をクリックします。
2. 特定のビューツリー要素を検索し、[JSスクリプトの実行](/ja/rparobotic-process-automation/03-node/02-data-processing/01-run-js-script) ノードを使用して要素の属性を取得します。
3. 特定のビューツリー要素を検索し、現在のノードの出力を使用して要素が存在するかどうかを確認します。これは、デバッグ時のログ出力と同様です。


[ビューツリーとは？](/ja/rparobotic-process-automation/05-appendix/02-what-is-a-view-tree)

## パラメータ

- **セレクタタイプ** ドロップダウン
- 要素の検索
- 前の要素を使用要素


「要素検索」を選択した場合、以下のDOMノード条件に基づいて要素をフィルタリングできます。設定した属性条件に一致する要素は、実行処理によって除外されます。

- **[条件が満たされた場合]**に必須条件を追加できます。以下の4つの条件をサポートし、最大4つのフィルタを同時に並列実行できます。
- text
- fullId
- class
- desc


開発者ツールから、現在のクラウドフォン画面の要素属性を取得できます。

- **[ページ上に複数の一致するオブジェクトがある場合]**
- 単一要素の取得
- **[どの要素を選択するか]**
- 「単一要素の取得」を選択すると、このオプションが表示されます。対応するインデックス番号を入力できます。例えば、1を入力すると、最初に一致する要素が取得されます。
- 要素リストの取得


「前の要素を使用」：実際の実行時に、要素のDOMノードを直接照合します。この機能は、「要素検索」ノードと組み合わせてよく使用されます。

- **要素が表示されるまでの最大待機時間**
- 数値を入力すると、現在のファインダーは検索対象の要素をポーリングします。要素が見つかると、処理が続行されます。この時間内に要素が見つからない場合は、次のノードの実行が開始されます。
- 数値を直接入力するか、参照できます。単位はミリ秒です。
- **[要素検索後の遅延時間]**


## 出力

- **出力パラメータ**
- 要素：ノード形式（実際にはJSON）で出力されます。「JSスクリプトを実行」を実行することで、要素の内容を直接解析できます。
- **実行ログ**
- 開始時刻
- 終了時刻
- 実行時間（ミリ秒）
- ステータス（成功/失敗）


## 例

1. Androidシステムのアプリ一覧ページで、「要素検索」ノードを使用して、各アプリのDOM要素を出力できます。次のステップでは、Loopノードを使用して各アプリのDOM要素を反復処理し、Run JS Scriptノードを使用して各アプリの名前を確認できます。


#### 設定:

| フィールド名 | フィールド値 |

| -------------------------------------------------------- | ----------------------------------------------- |

| **条件が満たされた場合** | "fullID" が "com.android.launcher3:id/icon" と等しい場合 |

| **ページ上に一致するオブジェクトが複数ある場合** | 要素リストを取得 |

| **要素が表示されるまでのタイムアウト** | 3000 |

| **要素が見つかった後の遅延** | 0 |

#### 出力:

##### 出力パラメータ

「**要素リスト**」は、以下の値を持つリストです。

details
summary
クリックして展開/折りたたみ
```json
    [ { "isScrollable": false, "centerX": 135, "uuid": "1b03ee9a-91bd-457f-9981-7f2bfba0905b", "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "index": 0, "isCheckable": false, "childCount": 0, "bounds": { "top": 261, "right": 270, "left": 0, "bottom": 621 }, "packageName": "com.android.launcher3", "isSelected": false, "isFocusable": true, "isPassword": false, "contentDescription": "Calendar", "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "centerY": 441, "text": "Calendar", "isVisibleToUser": true }, { "isScrollable": false, "text": "Chrome", "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "index": 1, "isCheckable": false, "uuid": "6446a15a-47e9-4ee3-adcd-8f63197653d4", "childCount": 0, "contentDescription": "Chrome", "packageName": "com.android.launcher3", "isSelected": false, "bounds": { "top": 261, "right": 540, "bottom": 621, "left": 270 }, "centerX": 405, "isFocusable": true, "isPassword": false, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "centerY": 441, "isVisibleToUser": true }, { "isScrollable": false, "centerX": 675, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "uuid": "d5ae8607-be23-4166-a332-32911dc5eae0", "isCheckable": false, "childCount": 0, "index": 2, "packageName": "com.android.launcher3", "isSelected": false, "isFocusable": true, "isPassword": false, "isClickable": true, "text": "Clock", "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "contentDescription": "Clock", "centerY": 441, "bounds": { "right": 810, "top": 261, "left": 540, "bottom": 621 }, "isVisibleToUser": true }, { "isScrollable": false, "contentDescription": "Contacts", "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "index": 3, "childCount": 0, "packageName": "com.android.launcher3", "isSelected": false, "text": "Contacts", "isFocusable": true, "isPassword": false, "centerX": 945, "uuid": "6f920c6c-221c-425c-b5b1-d438b1fc7fe9", "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "centerY": 441, "bounds": { "top": 261, "right": 1080, "bottom": 621, "left": 810 }, "isVisibleToUser": true }, { "isScrollable": false, "centerX": 135, "centerY": 801, "bounds": { "bottom": 981, "right": 270, "left": 0, "top": 621 }, "isLongClickable": true, "text": "Files", "resourceId": "com.android.launcher3:id/icon", "contentDescription": "Files", "isCheckable": false, "childCount": 0, "packageName": "com.android.launcher3", "index": 4, "isSelected": false, "isFocusable": true, "isPassword": false, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "uuid": "3e8b09e7-4948-4132-9ca8-0ca57cf5a12d", "isVisibleToUser": true }, { "isScrollable": false, "contentDescription": "Gallery", "centerY": 801, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "index": 5, "text": "Gallery", "packageName": "com.android.launcher3", "isSelected": false, "centerX": 405, "isFocusable": true, "isPassword": false, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "uuid": "7b1b7b09-3ca0-422d-b35a-37ce26e2517b", "isVisibleToUser": true, "bounds": { "bottom": 981, "right": 540, "top": 621, "left": 270 } }, { "isScrollable": false, "centerY": 801, "centerX": 675, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "packageName": "com.android.launcher3", "isSelected": false, "bounds": { "right": 810, "bottom": 981, "top": 621, "left": 540 }, "index": 6, "contentDescription": "Gmail", "uuid": "9b8815b9-1079-4969-bf77-c3b27e4656f0", "isFocusable": true, "isPassword": false, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true, "text": "Gmail" }, { "isScrollable": false, "text": "Instagram", "centerY": 801, "uuid": "045888d5-9154-4a2a-b6da-649f6c54e9da", "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "bounds": { "bottom": 981, "right": 1080, "top": 621, "left": 810 }, "isCheckable": false, "childCount": 0, "contentDescription": "Instagram", "packageName": "com.android.launcher3", "isSelected": false, "index": 7, "isFocusable": true, "isPassword": false, "centerX": 945, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true }, { "isScrollable": false, "index": 8, "uuid": "4ad6d1e9-02a4-4163-968b-b764968a2e1b", "centerX": 135, "text": "Messaging", "isLongClickable": true, "bounds": { "top": 981, "right": 270, "left": 0, "bottom": 1341 }, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "centerY": 1161, "contentDescription": "Messaging", "packageName": "com.android.launcher3", "isSelected": false, "isFocusable": true, "isPassword": false, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true }, { "isScrollable": false, "index": 9, "text": "MoreLogin Bot", "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "centerY": 1161, "packageName": "com.android.launcher3", "isSelected": false, "contentDescription": "MoreLogin Bot", "centerX": 405, "isFocusable": true, "isPassword": false, "isClickable": true, "uuid": "fa990303-fa24-4c27-bc1b-32dec1d15fc7", "bounds": { "top": 981, "right": 540, "bottom": 1341, "left": 270 }, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true }, { "isScrollable": false, "index": 10, "bounds": { "right": 810, "top": 981, "left": 540, "bottom": 1341 }, "centerX": 675, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "centerY": 1161, "packageName": "com.android.launcher3", "isSelected": false, "isFocusable": true, "isPassword": false, "isClickable": true, "contentDescription": "Open Camera", "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "text": "Open Camera", "uuid": "55fd0ae2-cb1b-44f9-93af-91064aaebea2", "isVisibleToUser": true }, { "isScrollable": false, "index": 11, "contentDescription": "Phone", "bounds": { "top": 981, "right": 1080, "bottom": 1341, "left": 810 }, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "uuid": "355737cc-e262-4c9a-872a-79ce9ff01bdd", "isCheckable": false, "childCount": 0, "centerY": 1161, "packageName": "com.android.launcher3", "isSelected": false, "text": "Phone", "isFocusable": true, "isPassword": false, "centerX": 945, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true }, { "isScrollable": false, "centerX": 135, "index": 12, "uuid": "dec9c272-397c-4395-8985-e2e583d5a567", "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "packageName": "com.android.launcher3", "isSelected": false, "isFocusable": true, "isPassword": false, "centerY": 1521, "isClickable": true, "text": "Play Store", "bounds": { "bottom": 1701, "right": 270, "left": 0, "top": 1341 }, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "contentDescription": "Play Store", "isVisibleToUser": true }, { "isScrollable": false, "contentDescription": "Search", "index": 13, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "bounds": { "bottom": 1701, "right": 540, "top": 1341, "left": 270 }, "childCount": 0, "text": "Search", "packageName": "com.android.launcher3", "isSelected": false, "centerX": 405, "isFocusable": true, "isPassword": false, "centerY": 1521, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true, "uuid": "5c96c836-ea08-49a8-809b-10e7efb218de" }, { "isScrollable": false, "uuid": "aaf1f6f6-109f-4b28-b0f4-1206f2fbeabc", "text": "Settings", "centerX": 675, "isLongClickable": true, "index": 14, "resourceId": "com.android.launcher3:id/icon", "isCheckable": false, "childCount": 0, "contentDescription": "Settings", "packageName": "com.android.launcher3", "isSelected": false, "isFocusable": true, "isPassword": false, "centerY": 1521, "isClickable": true, "bounds": { "right": 810, "bottom": 1701, "top": 1341, "left": 540 }, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "isVisibleToUser": true } ]
```

br
1. Androidシステムのアプリ一覧ページでは、「Find Element」ノードを使用して、条件に一致する要素リストの2番目のDOM要素の値を出力できます。「Tap Element」ノードを使用すると、その要素をクリックできます。


#### 設定:

| フィールド名 | フィールド値 |

| -------------------------------------------------------- | ---------------------------------------------- |

| **条件が満たされた場合** | "fullID が "com.android.launcher3:id/icon" と等しい場合 |

| **ページ上に一致するオブジェクトが複数存在する場合** | "単一要素を取得" |

| **どの要素を選択するか？** | "2" |

| **要素が表示されるまでのタイムアウト時間** | "3000" |

| **要素が見つかった後の遅延時間** | "0" |

#### 出力:

##### 出力パラメータ

"**Element**" は、以下の値を持つ要素オブジェクト (JSON) です。

details
summary
クリックして展開/折りたたみ
```json
    { "isScrollable": false, "text": "Chrome", "bounds": { "top": 261, "right": 540, "bottom": 621, "left": 270 }, "isLongClickable": true, "resourceId": "com.android.launcher3:id/icon", "index": 1, "isCheckable": false, "childCount": 0, "contentDescription": "Chrome", "packageName": "com.android.launcher3", "isSelected": false, "centerX": 405, "isFocusable": true, "isPassword": false, "isClickable": true, "isChecked": false, "isFocused": false, "isEnabled": true, "className": "android.widget.TextView", "centerY": 441, "isVisibleToUser": true, "uuid": "4aa1242a-daa8-46dd-8bf4-f100f3cf228a" }
```

contentDescriptionの値が「Chrome」になっていることが確認できます。次のステップでは、[Tap Element](/ja/rparobotic-process-automation/03-node/01-simulation-operations/04-tap-element)ノードを使用してこの要素をクリックできます。

## 関連ノード

- [Tap Element](/ja/rparobotic-process-automation/03-node/01-simulation-operations/04-tap-element)
- [Run JS Script](/ja/rparobotic-process-automation/03-node/02-data-processing/01-run-js-script)